Bug 6871 - [3.3/3.4 regression] const objects shouldn't be moved to .bss
Summary: [3.3/3.4 regression] const objects shouldn't be moved to .bss
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Jason Merrill
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2002-05-30 08:56 UTC by Ulrich Drepper
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
u.c (53 bytes, application/octet-stream)
2003-05-21 15:17 UTC, Ulrich Drepper
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Drepper 2002-05-30 08:56:02 UTC
The gcc CVS trunk contains code which moves variables which are initialized with all zeros into .bss (instead of .data).  But the current gcc doesn't stop there: it also moves constants into .bss instead of .text.  This is not what should happen since the .bss cannot be shared, unlike the .text.

Release:
gcc CVS trunk 2002-05-29

Environment:
x86 Linux

How-To-Repeat:
Compile the attached file with
  gcc -O2 -c u.c

The variable should be in .text and not in .bss.
Comment 1 Eric Botcazou 2003-02-19 10:10:49 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed on 3.3 and mainline.
Comment 2 Jason Merrill 2003-03-14 20:42:24 UTC
Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-Why: i'll take a look
Comment 3 Jason Merrill 2003-03-15 01:42:13 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/6871
Date: 15 Mar 2003 01:42:13 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-15 01:42:13
 
 Added files:
 	gcc/testsuite/gcc.dg: section1.c 
 
 Log message:
 	PR optimization/6871
 	* varasm.c (assemble_variable): Leave constant zeroes in .rodata.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/section1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 4 Jason Merrill 2003-03-15 01:42:56 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/6871
Date: 15 Mar 2003 01:42:56 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-15 01:42:56
 
 Modified files:
 	gcc            : ChangeLog 
 
 Log message:
 	PR optimization/6871
 	* varasm.c (assemble_variable): Leave constant zeroes in .rodata.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17086&r2=1.17087
 

Comment 5 Jason Merrill 2003-03-15 01:43:07 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/6871
Date: 15 Mar 2003 01:43:07 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-03-15 01:43:07
 
 Modified files:
 	gcc            : varasm.c 
 
 Log message:
 	PR optimization/6871
 	* varasm.c (assemble_variable): Leave constant zeroes in .rodata.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.333&r2=1.334
 

Comment 6 Jason Merrill 2003-03-15 01:44:10 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: fixed.
Comment 7 Jason Merrill 2003-03-15 01:44:40 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/6871
Date: 15 Mar 2003 01:44:40 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	jason@gcc.gnu.org	2003-03-15 01:44:40
 
 Modified files:
 	gcc            : ChangeLog varasm.c 
 
 Log message:
 	PR optimization/6871
 	* varasm.c (assemble_variable): Leave constant zeroes in .rodata.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.299&r2=1.16114.2.300
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.324.2.1&r2=1.324.2.2