|
From: | E. Weddington |
Subject: | Re: [avr-gcc-list] Re: WinAVR 20050214 (gcc 3.4.3) and optimizer bug. |
Date: | Sun, 08 May 2005 21:30:26 -0600 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
Vesa Jääskeläinen wrote:
Joerg Wunsch wrote:As Vesa Jääskeläinen wrote:I have been debugging why Ethernut brakes in certain situations with gcc. And found an optimizer bug.In this clause: if (ppv && (*ppv != 0)) { We are missing code for (ppv != 0), but code for *ppv != 0 is found. And if I pass NULL to this function it makes compare to incorrect memory location.
Regardless of whether there is a compiler bug, the above is incorrect C. You are NEVER supposed to rely on the fact that a NULL pointer is equal to zero, because, technically, it can be defined as something else. You should always directly compare a pointer to NULL as such:
if(ppv != NULL && (*ppv != 0)) Eric
[Prev in Thread] | Current Thread | [Next in Thread] |