Tested on gcc 4.0.2 20050808 and gcc 4.0.3 20051013 I don't know if this is a bug or a feature : this code, also compiled without optimization, doesn't check if the address of the variable is zero.
extern unsigned long int __spm_addr; int main(void) { return &__spm_addr ? __spm_addr + 1 : -1; } gcc 3.x checks the variable address. -- Summary: external variable address assumed not to be zero Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: frederic dot petrot at lip6 dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25954