This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37565] New: __optimize__ attribute doesn't work correctly
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2008 19:54:49 -0000
- Subject: [Bug c/37565] New: __optimize__ attribute doesn't work correctly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Many backends need to override optimization options after
we have processed all optimization options. It is done
in OVERRIDE_OPTIONS. But it is only called once for a given
input. We do have OPTIMIZATION_OPTIONS, which is executed
when the optimization options are changed via "pragma GCC optimize"
or by using the "optimize" attribute. But OPTIMIZATION_OPTIONS
isn't enough. On Linux/x86-64, it gives
[hjl@gnu-6 gcc]$ cat /tmp/x.i
void foo (void) __attribute__ ((__optimize__(2,"omit-frame-pointer")));
void
foo (void)
{
}
[hjl@gnu-6 gcc]$ ./xgcc -B./ -S /tmp/x.i -mno-accumulate-outgoing-args
-fomit-frame-pointer
/tmp/x.i:1: warning: unwind tables currently require either a frame pointer or
-maccumulate-outgoing-args for correctness
[hjl@gnu-6 gcc]$ ./xgcc -B./ -S /tmp/x.i -mno-accumulate-outgoing-args
[hjl@gnu-6 gcc]$
That means we may silently generate wrong codes. To properly support
"pragma GCC optimize" and the "optimize" attribute, we need a way for
a backend to override the optimization options whenever they are
changed.
--
Summary: __optimize__ attribute doesn't work correctly
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37565