public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57482] New: --help=optimizers reports a wrong list
@ 2013-05-31 9:28 christophe.beausoleil at sogeti dot com
2013-06-04 13:38 ` [Bug other/57482] [4.7.3][AVR] " gjl at gcc dot gnu.org
2013-06-10 8:04 ` christophe.beausoleil at sogeti dot com
0 siblings, 2 replies; 3+ messages in thread
From: christophe.beausoleil at sogeti dot com @ 2013-05-31 9:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57482
Bug ID: 57482
Summary: --help=optimizers reports a wrong list
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: christophe.beausoleil at sogeti dot com
Hello,
I am using GCC 4.7.3 built for AVR targets on a Linux machine. The command :
avr-gcc -mmcu=atmega128 -O1 -Q --help=optimizers
returns a list of enabled options for the -O1 optimization level.
Among these enabled options is :
-fshort-enums [enabled]
However, I can see that this option is not enabled by -O1. I simply did :
typedef enum {val1, val2} Tenum;
Tenum Venum;
I compile with :
avr-gcc -mmcu=atmega128 -O1 test.c -o test.elf
and check Venum size with :
avr-nm -S test.elf | grep Venum
which gives :
00800109 00000002 B Venum
I have to explicitly use -fshort-enums in my command line in order that GCC
takes it into account :
00800109 00000001 B Venum
I must also add that the problem is the same for -00 and -02.
The question is : how can I know which options are effectively enabled or not ?
Can I easily find the answer in source code ?
Thanks a lot for reading till here and for any support !
Best regards
Christophe
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug other/57482] [4.7.3][AVR] --help=optimizers reports a wrong list
2013-05-31 9:28 [Bug c/57482] New: --help=optimizers reports a wrong list christophe.beausoleil at sogeti dot com
@ 2013-06-04 13:38 ` gjl at gcc dot gnu.org
2013-06-10 8:04 ` christophe.beausoleil at sogeti dot com
1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-06-04 13:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57482
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|AVR ATmega128 |avr
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-04
CC| |gjl at gcc dot gnu.org
Component|c |other
Ever confirmed|0 |1
Build|4.7.3 |
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
I can confirm this with 4.7.2 and the following source file
== foo.c ==
typedef enum { A, B } ab_t;
int a[sizeof (ab_t) == 2 ? 1 : -1];
== compile ==
$ avr-gcc foo.c
$ avr-gcc foo.c -Q --help=optimizers | grep short.enum
-fshort-enums [enabled]
== issues ==
1) foo.c compiles fine, thus enums are 2 byte per default.
This shows the output of --help=optimizers is not correct.
2) -f[no-]short-enums is not an optimization option;
it's an option affecting the ABI. Better / worse code
is just a side effect of respective ABI change.
3) The backend does not implement TARGET_DEFAULT_SHORT_ENUMS
thus the default shall be like with -fno-short-enums, cf.
target.def defines the hook default to hook_bool_void_false.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug other/57482] [4.7.3][AVR] --help=optimizers reports a wrong list
2013-05-31 9:28 [Bug c/57482] New: --help=optimizers reports a wrong list christophe.beausoleil at sogeti dot com
2013-06-04 13:38 ` [Bug other/57482] [4.7.3][AVR] " gjl at gcc dot gnu.org
@ 2013-06-10 8:04 ` christophe.beausoleil at sogeti dot com
1 sibling, 0 replies; 3+ messages in thread
From: christophe.beausoleil at sogeti dot com @ 2013-06-10 8:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57482
--- Comment #3 from Christophe <christophe.beausoleil at sogeti dot com> ---
> 2) -f[no-]short-enums is not an optimization option;
Hum, I do not really agree although it is strongly related to ABI, no doubt.
Anyway, it is a very special option as I can see in opts.c :
/* Set this to a special "uninitialized" value. The actual default
is set after target options have been processed. */
opts->x_flag_short_enums = 2;
A few specific options are also treated here, but it seems to me that
-fshort-enum is the only optimization option concerned. Am I wrong ? Could it
be the only option which is not reported correctly by --help=optimizers ?
Reading target.def is really instructive, but I still do not understand (yet)
how the optimizations list is built, and how options are overwritten... All
this is very confusing.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-10 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 9:28 [Bug c/57482] New: --help=optimizers reports a wrong list christophe.beausoleil at sogeti dot com
2013-06-04 13:38 ` [Bug other/57482] [4.7.3][AVR] " gjl at gcc dot gnu.org
2013-06-10 8:04 ` christophe.beausoleil at sogeti dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).