This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]