re PR c/37303 (const compound initializers in structs are written to .data instead...
authorIan Lance Taylor <iant@google.com>
Tue, 1 May 2012 21:25:15 +0000 (21:25 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 1 May 2012 21:25:15 +0000 (21:25 +0000)
commita845a7f5aa73f695fd44fac430bf4ac684515173
treeed944aa62023941006f92af1582be1c26ecce946
parentb7a9facb2c4308b738b0785a291ae31f02d30b76
re PR c/37303 (const compound initializers in structs are written to .data instead of .rodata)

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.

From-SVN: r187027
gcc/ChangeLog
gcc/c-decl.c
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr37303.c [new file with mode: 0644]