This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/6871: const objects shouldn't be moved to .bss
- From: drepper at redhat dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 30 May 2002 15:50:39 -0000
- Subject: optimization/6871: const objects shouldn't be moved to .bss
- Reply-to: drepper at redhat dot com
>Number: 6871
>Category: optimization
>Synopsis: const objects shouldn't be moved to .bss
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 30 08:56:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Ulrich Drepper
>Release: gcc CVS trunk 2002-05-29
>Organization:
>Environment:
x86 Linux
>Description:
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.
>How-To-Repeat:
Compile the attached file with
gcc -O2 -c u.c
The variable should be in .text and not in .bss.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="u.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="u.c"
Y29uc3Qgc3RydWN0IHsKICBpbnQgYTsKICBpbnQgYjsKfSBmb28gPSB7IDAsIDAgfTsK