This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Null pointer dereference and side effects
Hi Alexandre & Archie,
>I think you really need to make the pointer volatile to prevent the
dereference from being optimized out.
Making a pointer volatile:
int * volatile p;
Making what the pointer points to volatile:
volatile int * p;
I presume the former is the prerequisite magic voodoo, and that between the
two they may optimize differently. (I haven't actually tested the
theory. Just wanted to point it out for Archie.)
Sincerely,
--Eljay