[coreboot] Makefiles question: -fno-delete-null-pointer-checks needed in Makefiles

ron minnich rminnich at gmail.com
Thu Mar 7 06:52:15 CET 2013


On Wed, Mar 6, 2013 at 8:29 AM, Jens Rottmann
<JRottmann at lippertembedded.de> wrote:

> Per default, after any *ptr, GCC assumes a SEGFAULT would occur if ptr was ==0, so if control flow does reach the following code ptr must be !=0. ==> After any *ptr GCC will optimize away all ptr==0 or !=0 checks.  I know that because I recently hunted a related bug for a week (U-Boot, ARM, different project) until I looked at the actual assembly code.


And here I thought that no-delete-null-pointer-checks had been taken
out after all the problems it caused. Silly me. I wonder how many of
the gcc compiler writers understand C's original purpose :-) I was
quite shocked when I read of this "optimization" some years ago.

Yeah, we need to ensure -fno-delete-null-pointer-checks is set on any
compiler foolish enough to implement this sort of thing.

ron



More information about the coreboot mailing list