public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> @ 2012-02-28 2:59 ` paracelsus at gmail dot com 2012-05-01 20:08 ` ian at airs dot com ` (4 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: paracelsus at gmail dot com @ 2012-02-28 2:59 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 Dag Ågren <paracelsus at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paracelsus at gmail dot com --- Comment #3 from Dag Ågren <paracelsus at gmail dot com> 2012-02-28 00:48:24 UTC --- This is still present in 4.6, and it is more severe than a "missed optimization". It breaks storing data in ROM on microcontrollers, which is very critical when you have very little RAM. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> 2012-02-28 2:59 ` [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata paracelsus at gmail dot com @ 2012-05-01 20:08 ` ian at airs dot com 2012-05-01 21:26 ` ian at airs dot com ` (3 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: ian at airs dot com @ 2012-05-01 20:08 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 Ian Lance Taylor <ian at airs dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ian at airs dot com Known to fail| | --- Comment #4 from Ian Lance Taylor <ian at airs dot com> 2012-05-01 20:06:35 UTC --- Potential patch: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00042.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> 2012-02-28 2:59 ` [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata paracelsus at gmail dot com 2012-05-01 20:08 ` ian at airs dot com @ 2012-05-01 21:26 ` ian at airs dot com 2012-05-01 21:26 ` ian at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: ian at airs dot com @ 2012-05-01 21:26 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 Ian Lance Taylor <ian at airs dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |4.8.0 --- Comment #6 from Ian Lance Taylor <ian at airs dot com> 2012-05-01 21:26:28 UTC --- Fixed on mainline for the future 4.8.0 release. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2012-05-01 21:26 ` ian at airs dot com @ 2012-05-01 21:26 ` ian at gcc dot gnu.org 2012-05-06 4:02 ` pinskia at gcc dot gnu.org 2012-09-26 20:33 ` sje at gcc dot gnu.org 5 siblings, 0 replies; 8+ messages in thread From: ian at gcc dot gnu.org @ 2012-05-01 21:26 UTC (permalink / raw) To: gcc-bugs 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> ` (3 preceding siblings ...) 2012-05-01 21:26 ` ian at gcc dot gnu.org @ 2012-05-06 4:02 ` pinskia at gcc dot gnu.org 2012-09-26 20:33 ` sje at gcc dot gnu.org 5 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2012-05-06 4:02 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 --- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-06 01:10:39 UTC --- This test fails on MIPS because the section is rdata rather than rodata. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> ` (4 preceding siblings ...) 2012-05-06 4:02 ` pinskia at gcc dot gnu.org @ 2012-09-26 20:33 ` sje at gcc dot gnu.org 5 siblings, 0 replies; 8+ messages in thread From: sje at gcc dot gnu.org @ 2012-09-26 20:33 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 --- Comment #8 from Steve Ellcey <sje at gcc dot gnu.org> 2012-09-26 20:33:32 UTC --- Author: sje Date: Wed Sep 26 20:33:28 2012 New Revision: 191772 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191772 Log: 2012-09-26 Steve Ellcey <sellcey@mips.com> PR c/37303 * gcc.dg/pr37303.c: Check for rdata or rodata. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/pr37303.c ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] New: const compound initializers in structs are written to .data instead of .rodata @ 2008-08-31 20:47 anders at kaseorg dot com 2008-09-02 20:58 ` [Bug c/37303] " pinskia at gcc dot gnu dot org 2008-10-01 17:27 ` pinskia at gcc dot gnu dot org 0 siblings, 2 replies; 8+ messages in thread From: anders at kaseorg dot com @ 2008-08-31 20:47 UTC (permalink / raw) To: gcc-bugs [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1229 bytes --] GCC generates identical code for the following two structures: const struct { const int *p; } foo = { (const int []) {1, 2, 3} }; const struct { int *p; } foo = { (int []) {1, 2, 3} }; In both cases, the struct is written to the .rodata section, but the array {1, 2, 3} is written to the .data section: .section .rodata .align 8 .type foo, @object .size foo, 8 foo: .quad __compound_literal.0 .data .align 4 .type __compound_literal.0, @object .size __compound_literal.0, 12 __compound_literal.0: .long 1 .long 2 .long 3 For the first struct, where the array is const, it should also be written to the .rodata section. Im using gcc 4.3.2-0ubuntu2 on Intrepid amd64. -- Summary: const compound initializers in structs are written to .data instead of .rodata Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: anders at kaseorg dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata 2008-08-31 20:47 [Bug c/37303] New: " anders at kaseorg dot com @ 2008-09-02 20:58 ` pinskia at gcc dot gnu dot org 2008-10-01 17:27 ` pinskia at gcc dot gnu dot org 1 sibling, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-09-02 20:58 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from pinskia at gcc dot gnu dot org 2008-09-02 20:57 ------- Confirmed, not a regression as far as I can tell. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pinskia at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |missed-optimization Known to fail| |3.3.3 4.0.1 4.1.1 4.4.0 Last reconfirmed|0000-00-00 00:00:00 |2008-09-02 20:57:27 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata 2008-08-31 20:47 [Bug c/37303] New: " anders at kaseorg dot com 2008-09-02 20:58 ` [Bug c/37303] " pinskia at gcc dot gnu dot org @ 2008-10-01 17:27 ` pinskia at gcc dot gnu dot org 1 sibling, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-10-01 17:27 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from pinskia at gcc dot gnu dot org 2008-10-01 17:25 ------- >From C99 6.5.2.5/8: "String literals, and compound literals with const-qualified types, need not designate distinct objects" -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-09-26 20:33 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-37303-4@http.gcc.gnu.org/bugzilla/> 2012-02-28 2:59 ` [Bug c/37303] const compound initializers in structs are written to .data instead of .rodata paracelsus at gmail dot com 2012-05-01 20:08 ` ian at airs dot com 2012-05-01 21:26 ` ian at airs dot com 2012-05-01 21:26 ` ian at gcc dot gnu.org 2012-05-06 4:02 ` pinskia at gcc dot gnu.org 2012-09-26 20:33 ` sje at gcc dot gnu.org 2008-08-31 20:47 [Bug c/37303] New: " anders at kaseorg dot com 2008-09-02 20:58 ` [Bug c/37303] " pinskia at gcc dot gnu dot org 2008-10-01 17:27 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).