Serious code generation/optimisation bug (I think)
Paolo Bonzini
bonzini@gnu.org
Tue Jan 27 08:33:00 GMT 2009
James Dennett wrote:
> On Mon, Jan 26, 2009 at 11:52 PM, <zoltan@bendor.com.au> wrote:
>> I was debugging a function and by inserting the debug statement crashed
>> the system. Some investigation revealed that gcc 4.3.2 arm-eabi (compiled
>> from sources) with -O2 under some circumstances assumes that if a pointer
>> is dereferenced, it can not be NULL therefore explicite tests against
>> NULL can be later eliminated.
>
> That's an optimization permitted by the language standard, but
> possibly unhelpful on your particular target.
Not really, he's just using the sloppiness allowed by MMU-less targets,
but he doesn't care about the value passed to Debug if tst == NULL.
However, -fno-delete-null-pointer-checks will do.
Paolo
More information about the Gcc
mailing list