[Bug middle-end/44690] -fzero-initialized-in-bss does not work
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44690 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |8.0 --- Comment #4 from Andrew Pinski --- Fixed by r8-2857-g2ec399d8a6c9c26 (there was a few followups patches which fix problems with this patch too).
[Bug middle-end/44690] -fzero-initialized-in-bss does not work
--- 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 00600818 0814 0018 WA 0 0 8 Num:Value Size TypeBind Vis Ndx Name 55: 00600828 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
[Bug middle-end/44690] -fzero-initialized-in-bss does not work
--- 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
[Bug middle-end/44690] -fzero-initialized-in-bss does not work
--- 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