Date: Tue, 13 Mar 2007 13:33:01 +0100 From: Max Laier <max@love2party.net> To: freebsd-current@freebsd.org Subject: Re: Bad gcc -O optimization cause core dump. What to do? Message-ID: <200703131333.11692.max@love2party.net> In-Reply-To: <20070313121106.GA96293@nagual.pp.ru> References: <20070313121106.GA96293@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tuesday 13 March 2007 13:11, Andrey Chernov wrote:
> Copy the segment below to the file a.c
> ---------------------- cut me here ---------------------
> #include <stdio.h>
>
> main() {
> printf("%s\n", NULL);
> }
> ---------------------- cut me here ---------------------
> Compile first as
> cc a.c
> ./a.out
> got
> (null)
> Then compile as
> cc -O a.c
> ./a.out
> got core dump.
...
> 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
--
/"\ Best regards, | mlaier@freebsd.org
\ / Max Laier | ICQ #67774661
X http://pf4freebsd.love2party.net/ | mlaier@EFnet
/ \ ASCII Ribbon Campaign | Against HTML Mail and News
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
iD8DBQBF9poHXyyEoT62BG0RAqPwAJ9OFBUGwQqZcagQU4Aji8kHy2F6wQCcCHRz
gOPehzSH5fw+bsYLAsmrS7A=
=hKZl
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703131333.11692.max>
