Null pointer dereference and side effects

Eljay Love-Jensen eljay@adobe.com
Wed Jul 21 11:33:00 GMT 2004


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



More information about the Gcc-help mailing list