This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47980] Inefficient code for local const char arrays
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 3 Mar 2011 22:00:16 +0000
- Subject: [Bug c/47980] Inefficient code for local const char arrays
- Auto-submitted: auto-generated
- References: <bug-47980-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47980
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-03 21:59:50 UTC ---
I believe f could do:
assert (arg != "aoeuaoeuaeouaeouaoeuaoeaoxbxod");
which would then fail with the proposed optimization. It is unspecified if
two string literals with the same content are distinct objects, but foo must be
a distinct object (ok, with static const char foo[] =
"aoeuaoeuaeouaeouaoeuaoeaoxbxod"; and -fmerge-all-constants which ignores some
C requirements it doesn't have to).