This is the mail archive of the gcc@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: GCC 3.4 optimisation of if (&ptr == NULL)



On Dec 3, 2003, at 17:30, John Neil wrote:


I recently spent time upgrading my embedded application form gcc 3.2 to the
current cvs version of gcc 3.4. Whilst doing this I found that gcc 3.4 was
removing the "if (&ptr == NULL) as shown in the following test case


extern void* g_ptr;


What you want is to mark the variable as weak otherwise GCC assumes the address is not
0.


Thanks,
Andrew Pinski


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