Commit af75fb67 by Jason Merrill Committed by Jason Merrill

re PR rtl-optimization/6871 (const objects shouldn't be moved to .bss)

        PR optimization/6871
        * varasm.c (assemble_variable): Leave constant zeroes in .rodata.

From-SVN: r64387
parent adf936a6
2003-03-14 Jason Merrill <jason@redhat.com>
PR optimization/6871
* varasm.c (assemble_variable): Leave constant zeroes in .rodata.
2003-03-14 Neil Booth <neil@daikokuya.co.uk> 2003-03-14 Neil Booth <neil@daikokuya.co.uk>
* c-opts.c (finish_options): New. * c-opts.c (finish_options): New.
......
/* PR optimization/6871 */
/* Constant variables belong in .rodata, not .bss. */
/* { dg-final { scan-assembler-not "\.bss" } } */
const int i = 0;
...@@ -1551,6 +1551,8 @@ assemble_variable (decl, top_level, at_end, dont_output_data) ...@@ -1551,6 +1551,8 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
else if (DECL_INITIAL (decl) == 0 else if (DECL_INITIAL (decl) == 0
|| DECL_INITIAL (decl) == error_mark_node || DECL_INITIAL (decl) == error_mark_node
|| (flag_zero_initialized_in_bss || (flag_zero_initialized_in_bss
/* Leave constant zeroes in .rodata so they can be shared. */
&& !TREE_READONLY (decl)
&& initializer_zerop (DECL_INITIAL (decl)))) && initializer_zerop (DECL_INITIAL (decl))))
{ {
unsigned HOST_WIDE_INT size = tree_low_cst (DECL_SIZE_UNIT (decl), 1); unsigned HOST_WIDE_INT size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment