This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Serious code generation/optimisation bug (I think)
Richard Guenther wrote:
> On Tue, Jan 27, 2009 at 11:35 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>>>>> Not for PTA though ;)
>>>> Care to expand?
>>> PTA tracks points-to-NULL as pointing to "nothing".
>>> This probably should be conditional on -fdelete-null-pointer-checks.
>>> Otherwise *NULL and *anything won't alias.
>> Yes, you're right. I'll see if I can construct a testcase and a patch.
>
> Thanks.
It is now PR38984. Andrew's point about -fnon-call-exceptions is also
worth pondering (and that's an understatement).
>> BTW, I was thinking of not doing the optimization anyway on volatile
>> pointers. What do you think?
>
> It should be taken care of automatically by loading it from memory
> before each dereference, no?
In this case, I meant more specifically the NULL test optimization that
the OP stumbled in. That would be a GCC extension, not taking advantage
for volatile pointers of the undefinedness that the standard guarantees.
Paolo