Type Punning and -O3 on gcc 4.8.1 and 4.8.2

Andrew Haley aph@redhat.com
Fri Nov 15 09:05:00 GMT 2013

On 11/14/2013 10:14 PM, Andy Schneider wrote:
>> consider using a free web-based e-mail account 
> Done
>> Please send us a test case that we can run.
> I'm currently unable to create a test case that doesn't pull with it
> a whole string of dependencies. Trivial mutations to the code result
> in the issue dissapearing. Given that, I thought I'd ask the more
> general question which was "is this code unsafe in gcc 4.8?". If
> it's considered unsafe I can fix that code. If it's considered safe
> and it's not a known issue then it's worth me spending more time
> trying to construct a test case.

I can't see anything immediately wrong with it.  GCC knows that union
members alias each other.

The fact that it's not reproducable in a simple test case is an
important clue that the problem may lie elsewhere.

> Additionally, if there are some diagnostics that might help me debug
> this type of issue, please let me know.

I presume you have already turned on all the warnings you can find and
fixed all the problems.  Particularly -Wstrict-aliasing.


More information about the Gcc-help mailing list