GCC screws up pointer->ulong conversion on 32 bit systems

Johannes Pfau nospam at example.com
Sat Nov 9 09:53:19 PST 2013


Am Sat, 9 Nov 2013 17:01:43 +0000
schrieb Iain Buclaw <ibuclaw at ubuntu.com>:

> On 9 November 2013 12:19, Johannes Pfau <nospam at example.com> wrote:
> > The fix is simple:
> > in gcc/convert.c(convert_to_integer):
> >
> > /* Convert to an unsigned integer of the correct width first, and
> > from there widen/truncate to the required type.  Some targets
> > support the coexistence of multiple valid pointer sizes, so fetch
> > the one we need from the type.  */
> >       expr = fold_build1 (CONVERT_EXPR,
> >                           lang_hooks.types.type_for_size
> >                             (TYPE_PRECISION (intype), 0),
> >                           expr);
> >
> >
> That code does seem to contradict what the comment is saying.  I'll
> raise it in #gcc and send a patch  (unless you want to do it).
> 
> 

It indeed seems like it's only a small oversight. It'd be
great if you could report it.


More information about the D.gnu mailing list