gcc 4.0.0 on amd64: problem with -O2?

Falk Hueffner falk@debian.org
Sun May 8 10:09:00 GMT 2005


Harald Dunkel <harald.dunkel@t-online.de> writes:

> Andrew Pinski wrote:
>> Wrong, try again.  Violating aliasing rules cause undefined behavior
>> so seg faulting is an okay thing to do.
>
> But producing a warning message and bad code is not OK. Either
> using a "type-punned pointer" should be treated as a fatal
> error, because gcc would create bad code, or gcc should create
> working code.
>
> If gcc knows that the code is bad, why does it continue?

It doesn't know that. The warning is for the *creation* of the
type-punned pointer, which is still perfectly fine. Gcc is too stupid
to notice whether you actually dereference it.

-- 
	Falk



More information about the Gcc-bugs mailing list