Bad gcc -O optimization cause core dump. What to do?

Andrey Chernov ache at freebsd.org
Tue Mar 13 13:08:08 UTC 2007


On Tue, Mar 13, 2007 at 01:33:01PM +0100, Max Laier wrote:
> > It calls "puts(NULL)" with core dump.
> > It means "printf("%s\n", NULL)" is overoptimized.
> > BTW, things like "printf("1%s\n", NULL)" are not overoptimized.
> > Any ideas? Is it right or needs to be fixed?
> 
> See: http://www.ciselant.de/projects/gcc_printf/gcc_printf.html 3.1

So, treated as "not a bug" by gcc people. 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15685

Sigh. It means printf-coding requires now intrinsic knowledge of gcc 
implementation details because our printf confusingly prints "(null)" too.
Convert printf back to segfault? ;)

-- 
http://ache.pp.ru/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20070313/86e77138/attachment.pgp


More information about the freebsd-current mailing list