Hi, Archie! Long time... On Jul 18, 2004, Archie Cobbs <archie@xxxxxxxxxxxx> wrote: > r2 = (void *)0; /* or (void *)1, etc. */ > if (*r1 != *r2) > return 1; > return 1; > However, in my application I'm relying on the side effects of > dereferencing a null pointer (ie., SEGV signal), so that causes > bugs for me. > I understand that according to the C standard dereferencing a null > pointer results in "undefined" behavior, so gcc is not behaving > incorrectly. > However, is there some way to get the desired semantics? If you insert an `asm ("" : "+X" (r2));' statement after the assignment to r2, such that the compiler will no longer have any idea that r2 is NULL, and won't optimize away the dereference. -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}