[Bug c/37303] const compound initializers in structs are written to .data instead of .rodata

ian at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 1 21:26:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303

--- Comment #5 from ian at gcc dot gnu.org <ian at gcc dot gnu.org> 2012-05-01 21:25:20 UTC ---
Author: ian
Date: Tue May  1 21:25:15 2012
New Revision: 187027

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187027
Log:
gcc/:
    PR c/37303
    * c-decl.c (build_compound_literal): Make the decl readonly if it
    an array of a readonly type.
    * gimplify.c (gimplify_compound_literal_expr): Add fallback
    parameter.  Change all callers.  If the decl is not addressable
    and is not an l-value, make it readonly.
gcc/testsuite:
    PR c/37303
    * gcc.dg/pr37303.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr37303.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-bugs mailing list