Package segfaults when built with -O2 but not with -O0

Ralf Corsepius rc040203 at freenet.de
Sat Nov 19 16:47:00 UTC 2011


On 11/19/2011 06:23 AM, Gregory Maxwell wrote:
> On Fri, Nov 18, 2011 at 11:27 PM, Ralf Corsepius<rc040203 at freenet.de>  wrote:
>> [1] -Wstrict-aliasing is one of these cases.
>> The spots such warnings point to, often are broken, but not always,
>> because GCC has difficulties in identifying these.
>
> This use to be more true, but there are multiple levels of -Wstrict-aliasing
I know.

> and
> I would be _highly_ surprised if the default gave a false alarm.
At least older gccs (IIRC, gcc-4.4.x) did fairly often.
gcc-4.6.x is less agressively warning.

>> If GCC is sure something is wrong, it is supposed to raise errors.
>
> This isn't true. E.g. you can write code which reads and uses
> uninitialized memory
> where the compiler is _absolutely sure_ of it. You still just get a warning.
Well, ... this would qualify as a bug in GCC, IMHO.

Ralf



More information about the devel mailing list