This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/63440] -Og does enable -fmerge-constants too
- From: "rdiezmail-gcc at yahoo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Oct 2014 13:36:41 +0000
- Subject: [Bug other/63440] -Og does enable -fmerge-constants too
- Auto-submitted: auto-generated
- References: <bug-63440-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63440
--- Comment #2 from R. Diez <rdiezmail-gcc at yahoo dot de> ---
Yes, I would enable -fmerge-constants with -Og.
I would do it even for -O0. Merging constants should be safe, and it saves
precious program space when generating debug builds for small embedded targets.
Besides, in my opinion, it does not make sense that the addresses of some
literal strings suddenly change when you enable optimisations, because they get
collapsed. Any bugs because of such shared addresses should be apparent in
debug builds too.
Note that GCC already seems to apply some optimisations when building with -O0.
Specifically, I believe that at least some dead code elimination does occur.
That would make sense, as you do not want to bloat your debug builds
unnecessary.