This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/31150] New: [4.1/4.2/4.3 Regression] Not promoting an whole array to be static const
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Mar 2007 16:46:39 -0000
- Subject: [Bug middle-end/31150] New: [4.1/4.2/4.3 Regression] Not promoting an whole array to be static const
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Take:
int main()
{
char str[2][34] = {"a","b"};
__builtin_puts(str[0]);
return 0;
}
In 4.0.2, we used to get:
static char C.0[2][34] = {"a", "b"};
char str[2][34];
str = C.0;
__builtin_puts (&str[0][0]);
But in 4.1.1 and above, we get:
char str[2][34];
str = {};
str[0] = "a";
str[1] = "b";
Which causes us to first zero out the array and then do load/stores on the
stack.
--
Summary: [4.1/4.2/4.3 Regression] Not promoting an whole array to
be static const
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31150