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
This commit is contained in:
Jason Merrill 2003-03-14 20:43:07 -05:00 committed by Jason Merrill
parent adf936a606
commit af75fb675d
3 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,8 @@
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>
* c-opts.c (finish_options): New.

View file

@ -0,0 +1,5 @@
/* PR optimization/6871 */
/* Constant variables belong in .rodata, not .bss. */
/* { dg-final { scan-assembler-not "\.bss" } } */
const int i = 0;

View file

@ -1551,6 +1551,8 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
else if (DECL_INITIAL (decl) == 0
|| DECL_INITIAL (decl) == error_mark_node
|| (flag_zero_initialized_in_bss
/* Leave constant zeroes in .rodata so they can be shared. */
&& !TREE_READONLY (decl)
&& initializer_zerop (DECL_INITIAL (decl))))
{
unsigned HOST_WIDE_INT size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);