This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/35561] Promote written once local aggregates to static


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]