Gentoo Archives: gentoo-dev

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Should this be considered a gcc bug?
Date: Tue, 21 Apr 2015 04:35:52
Message-Id: 20150421093524.38af30f7125f42e3d02d9984@gentoo.org
In Reply to: [gentoo-dev] Should this be considered a gcc bug? by grozin@gentoo.org
1 Hi,
2
3 On Tue, 21 Apr 2015 09:57:16 +0600 (NOVT) grozin@g.o wrote:
4 > Hello *,
5 >
6 > There was a bug #526194 - dev-lisp/sbcl does not respect CFLAGS. It was
7 > "fixed" by Mark Wright <gienah@g.o> on Jan 31 - Feb 1. However,
8 > after this fix the upstream CFLAGS were appended to the user-supplyed
9 > ${CFLAGS}. And the upstream CFLAGS contain -O3. So, is a user has, e.g.,
10 > -O2 in his/her ${CFLAGS}, it was silently replaced by -O3. For some time,
11 > nobody noticed this: gcc-4.8 happily compiled the C stuff in sbcl with
12 > -O3.
13 >
14 > However, after the upgrade to gcc-4.9 problems began (bug #544070). On
15 > amd64, gcc is still happy co compile sbcl with -O3. However, on x86 this
16 > leads to a crash of a freshly compiled sbcl runtime. Namely, the
17 > combinations
18 >
19 > -O2 -march=<something>
20 > -O3
21 >
22 > behave correctly, and produce a working sbcl; but
23 >
24 > -O3 -march=<something>
25 >
26 > lead to the crush. I have changed the above "fix" in sbcl-1.2.10 in such a
27 > way that now it appends only -g -Wall -Wsign-compare to ${CFLAGS}, but
28 > not -O3. This resolves the bug #544070, unless a user has -O3
29 > -march=<something> in his/her ${CFLAGS}.
30 >
31 > Shouldn't gcc-4.9 on x86 produce with -O3 something functionally
32 > equivalent to the -O2 case, only more optimized? Should this be considered
33 > a gcc-4.9 bug?
34
35 Please look at gcc-4.9 manual for the list of -O3 expansion and
36 find what flag exactly causes this issue. There may be two reasons:
37 gcc bug and sbcl bug. While you have correctly pointed out that
38 this may be a problem in gcc, another possibility is that extra
39 optimization triggers some problem in the code itself, which causes
40 a segfault.
41
42 Best regards,
43 Andrew Savchenko