* Jens Rottmann JRottmann@LiPPERTembedded.de [130306 17:29]:
Hi Martin (and all),
I wrote:
You dereference dev in line 132, so if it's really 0, will you then ever reach this check?? (I don't know if in romstage *NULL is caught.)
You wrote:
yes, if it's 0, we still reach the code. I've changed it to not dereference it before checking it though.
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.
Are you sure romstage (or maybe even ramstage?) will *NULL without segfaulting and just continue? And is romstage compiled with GCC (+ CAR) or is romcc used?
In that case "-fno-delete-null-pointer-checks" must be added to the GCC options. http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
I greped a bit, looks like it's not in any Makefiles yet.
Could someone who knows Coreboot's make/build system better than me maybe help, please?
Does this option exist on all newer GCCs? e.g everything 4.2 and up? In that case we can just stuff it into the Makefile. Otherwise we should add a check in xcompile.
Thanks Jens
-- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot