Re: gcc on 64 bit && different behaviour while 'cast to pointer from integer of different size'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/07/15 08:46, Matthias Apitz wrote:
> Why does the gcc 3.4.3 correct this problem on the fly and stores
> the full 64 bit pointer into the receiving char pointer, while the
> gcc 4.4.2 does not? 
> 
> When this feature or behaviour was changed after gcc 3.4.3?
> 
> Is this somehow a command line flag for gcc to control the behaviour?

The question is whether the 64-bit function pointer is truncated when
it is read from register RAX on return from the function.  This is a
matter for the system ABI: it's not something that GCC decides.  The
x86_64 ABI changed during this timeframe, and you might be seeing an
effect of that.  I can't remember exactly when the changes were made.

However, this is also the kind of thing which can also vary depending
on the optimization level.  Turn on optimization and it might all
break.  You can't depend on good luck to make this work.

Andrew.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux