This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/35561] Promote written once local aggregates to static
- From: "svfuerst at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 23 Jun 2011 03:14:18 +0000
- Subject: [Bug middle-end/35561] Promote written once local aggregates to static
- Auto-submitted: auto-generated
- References: <bug-35561-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35561
Steven Fuerst <svfuerst at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |svfuerst at gmail dot com
--- Comment #6 from Steven Fuerst <svfuerst at gmail dot com> 2011-06-23 03:14:13 UTC ---
Still a problem in 4.6 at all optimization levels.
int foo1(int x)
{
int a[] = {1,4,7,9};
return a[x];
}
int foo2(int x)
{
static int a[] = {1,4,7,9};
return a[x];
}
foo1() creates the array on the stack using a series of mov instructions,
whereas the code generated for foo2() is much nicer.