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

From: Max Laier <max_at_love2party.net>
Date: Tue, 13 Mar 2007 13:33:01 +0100
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_at_freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier_at_EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

Received on Tue Mar 13 2007 - 11:33:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:06 UTC