Kyle Moffett wrote:
On Mar 30, 2005, at 18:38, Jakub Jelinek wrote:This testcase violates ISO C99 6.3.2.3: If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function.Except that the result of dereferencing a null pointer is implementation defined according to the C99 standard. My implementation allows me to mmap stuff at NULL, and therefore its compiler should be able to handle that case. I would have no problem with either the standard or implementation if it either properly handled the case or didn't allow it in the first place.On another note, I've discovered the flag "-fno-delete-null-pointer-checks",which should probably be included in the kernel makefiles to disable thatoptimization for the kernel. (Ok, yes, I apologize, this isn't really a GCCbug, the behavior is documented, although it can be quite confusing. I suspect it may bite some platform-specific code someday. It also muddies the waters somewhat with respect to the original note (and the effects on the generated code):int x = my_struct->the_x; if (!my_struct) return;
Why should this be in the kernel makefiles? If my_struct is NULL, then the kernel will never reach the if statement. A warning might be nice though. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- References:
- Re: Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use)
- From: Horst von Brand <[email protected]>
- Re: Do not misuse Coverity please
- From: "Jean Delvare" <[email protected]>
- Re: Do not misuse Coverity please
- From: Shankar Unni <[email protected]>
- Re: Do not misuse Coverity please
- From: Paulo Marques <[email protected]>
- Big GCC bug!!! [Was: Re: Do not misuse Coverity please]
- From: Kyle Moffett <[email protected]>
- Not a GCC bug (was Re: Big GCC bug!!! [Was: Re: Do not misuse Coverity please])
- From: Jakub Jelinek <[email protected]>
- Re: Not a GCC bug (was Re: Big GCC bug!!! [Was: Re: Do not misuse Coverity please])
- From: Kyle Moffett <[email protected]>
- Re: Do not misuse Coverity please (Was: sound/oss/cs46xx.c: fix a check after use)
- Prev by Date: Re: [PATCH] USB: usbnet uses netif_msg_*() ethtool filtering
- Next by Date: Re: [PATCH] USB: pegasus uses netif_msg_*() filters
- Previous by thread: Re: Not a GCC bug (was Re: Big GCC bug!!! [Was: Re: Do not misuse Coverity please])
- Next by thread: Re: Not a GCC bug (was Re: Big GCC bug!!! [Was: Re: Do not misuse Coverity please])
- Index(es):