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

            Bug ID: 98702
           Summary: linker failure with a very simple testing case for
                    gcc10
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qinzhao at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49980
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49980&action=edit
tar file that can repeat the failure

with gcc10.2.1, the following simple testing case failed during linking:

[qinzhao@localhost 32383604]$ cat t.h
int NUMERRS; 
[qinzhao@localhost 32383604]$ cat t.c
#include "t.h"
[qinzhao@localhost 32383604]$ cat t1.c
#include "t.h" 
int main() 
{ 
  NUMERRS = 0;
  return 0; 
} 
[qinzhao@localhost 32383604]$ /home/qinzhao/Install/latest-10/bin/gcc t.c -c -o
t.o  
[qinzhao@localhost 32383604]$ /home/qinzhao/Install/latest-10/bin/gcc t1.c -c
-o t1.o
[qinzhao@localhost 32383604]$ /home/qinzhao/Install/latest-10/bin/gcc t.o t1.o
-o exe.gcc10
t1.o:(.bss+0x0): multiple definition of `NUMERRS'
t.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
[qinzhao@localhost 32383604]$ 

gcc8 and gcc9 do not have this issue.

by examine the object file, I can see gcc10 generate NUMERRS to .bss section,
but gcc8 and gcc9 generate NUMERRS to COM section.

is this a new bug in gcc10?

Reply via email to