Robert Dewar wrote:
> James Dennett wrote:
> 
>> I don't know how much work it would be to disable this optimization in
>> gcc.
> 
> To me, it is always troublesome to talk of "disable this optimization"
> in a context like this.

In general I agree; on the other hand, for this particular optimization
I'm a bit more sympathetic because the optimization is clearly bogus for
MMU-less targets, and in fact AVR disables it completely in its option
processing code.  In other words, making NULL pointer dereferences
implementation-defined would not be enough, but making them undefined
tout-court seems a bit too strong.

Note that applying the optimization in the case of the OP's code, in my
opinion, is correct.  That's what I meant by my answer to James Dennett:
Zoltan thought he could afford being sloppy, or clever, or both, but he
knew perfectly that he couldn't have done so on another target.

Paolo

Reply via email to