public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/44690]  New: -fzero-initialized-in-bss does not work
@ 2010-06-27 12:25 jan dot kratochvil at redhat dot com
  2010-07-21 22:24 ` [Bug middle-end/44690] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-06-27 12:25 UTC (permalink / raw)
  To: gcc-bugs

const int i;     -fno-zero-initialized-in-bss -> .bss    = FAIL
const int i;        -fzero-initialized-in-bss -> .bss    
const int i = 0; -fno-zero-initialized-in-bss -> .rodata
const int i = 0;    -fzero-initialized-in-bss -> .rodata = FAIL
const int i = 1; -fno-zero-initialized-in-bss -> .rodata
const int i = 1;    -fzero-initialized-in-bss -> .rodata

gcc (GCC) 4.6.0 20100627 (experimental)
(gcc-4.4+ behaves the same)

-fzero-initialized-in-bss is the default now.

(a) Creating .robss would solve it all but OK, there isn't any.

(b) At least -O0 -g should default to -fno-zero-initialized-in-bss as it better
    catches bugs of modified const zeroed variables.


-- 
           Summary: -fzero-initialized-in-bss does not work
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/44690] -fzero-initialized-in-bss does not work
  2010-06-27 12:25 [Bug middle-end/44690] New: -fzero-initialized-in-bss does not work jan dot kratochvil at redhat dot com
@ 2010-07-21 22:24 ` pinskia at gcc dot gnu dot org
  2010-07-21 22:56 ` pinskia at gcc dot gnu dot org
  2010-07-23 11:11 ` jan dot kratochvil at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-21 22:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-07-21 22:23 -------
const int i;     -fno-zero-initialized-in-bss -> .bss    = FAIL
You need -fno-common also to get it out of the BSS.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/44690] -fzero-initialized-in-bss does not work
  2010-06-27 12:25 [Bug middle-end/44690] New: -fzero-initialized-in-bss does not work jan dot kratochvil at redhat dot com
  2010-07-21 22:24 ` [Bug middle-end/44690] " pinskia at gcc dot gnu dot org
@ 2010-07-21 22:56 ` pinskia at gcc dot gnu dot org
  2010-07-23 11:11 ` jan dot kratochvil at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-21 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2010-07-21 22:56 -------
>const int i = 0;    -fzero-initialized-in-bss -> .rodata = FAIL

This is correct because it should really be in readonly data section as it is
constant.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/44690] -fzero-initialized-in-bss does not work
  2010-06-27 12:25 [Bug middle-end/44690] New: -fzero-initialized-in-bss does not work jan dot kratochvil at redhat dot com
  2010-07-21 22:24 ` [Bug middle-end/44690] " pinskia at gcc dot gnu dot org
  2010-07-21 22:56 ` pinskia at gcc dot gnu dot org
@ 2010-07-23 11:11 ` jan dot kratochvil at redhat dot com
  2 siblings, 0 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-07-23 11:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jan dot kratochvil at redhat dot com  2010-07-23 11:11 -------
(In reply to comment #1)
> const int i;     -fno-zero-initialized-in-bss -> .bss    = FAIL
> You need -fno-common also to get it out of the BSS.

-fno-common now at least correctly reports:
echo 'const int i;'|gcc -fno-common -c -o k.o -x c -;echo 'const int
i;main(){}'|gcc -fno-common -c -o l.o -x c -;gcc -fno-common -o k k.o l.o
l.o:(.bss+0x0): multiple definition of `i'
k.o:(.bss+0x0): first defined here

So it is no longer SHN_COMMON, thanks.


But reopening the Bug as it is still in .bss, not in .rodata.

echo 'const int i;int main(){return *(int *)&i = 0;}'|gcc -fno-common -Wall -o
1 -x c -;./1;echo $?
0
  [25] .bss              NOBITS           0000000000600818  00000814
       0000000000000018  0000000000000000  WA       0     0     8
   Num:    Value          Size Type    Bind   Vis      Ndx Name
    55: 0000000000600828     4 OBJECT  GLOBAL DEFAULT   25 i

It should SEGV but it does not.
-f{,no-}zero-initialized-in-bss has no effect on it.


-- 

jan dot kratochvil at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/44690] -fzero-initialized-in-bss does not work
       [not found] <bug-44690-4@http.gcc.gnu.org/bugzilla/>
@ 2021-10-03  3:01 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-03  3:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |8.0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed by r8-2857-g2ec399d8a6c9c26 (there was a few followups patches which fix
problems with this patch too).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-03  3:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-27 12:25 [Bug middle-end/44690] New: -fzero-initialized-in-bss does not work jan dot kratochvil at redhat dot com
2010-07-21 22:24 ` [Bug middle-end/44690] " pinskia at gcc dot gnu dot org
2010-07-21 22:56 ` pinskia at gcc dot gnu dot org
2010-07-23 11:11 ` jan dot kratochvil at redhat dot com
     [not found] <bug-44690-4@http.gcc.gnu.org/bugzilla/>
2021-10-03  3:01 ` pinskia at gcc dot gnu.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).