https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69940
Bug ID: 69940
Summary: gcc.c-torture/execute/alias-3.c FAILs with Solaris/x86
as
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ro at gcc dot gnu.org
Target Milestone: ---
Host: i386-pc-solaris2.*
Target: i386-pc-solaris2.*
Build: i386-pc-solaris2.*
The gcc.c-torture/execute/alias-3.c testcase FAILs on Solaris/x86 with Solaris
as,
both 32 and 64-bit:
FAIL: gcc.c-torture/execute/alias-3.c -O0 execution test
FAIL: gcc.c-torture/execute/alias-3.c -O1 execution test
FAIL: gcc.c-torture/execute/alias-3.c -O2 execution test
FAIL: gcc.c-torture/execute/alias-3.c -O2 -flto execution test
FAIL: gcc.c-torture/execute/alias-3.c -O2 -flto -flto-partition=none
execution test
FAIL: gcc.c-torture/execute/alias-3.c -O3 -g execution test
FAIL: gcc.c-torture/execute/alias-3.c -Os execution test
The test aborts like this:
Program received signal SIGABRT, Aborted.
[Switching to Thread 1 (LWP 1)]
0xfe5b8545 in __lwp_sigqueue () from /lib/libc.so.1
(gdb) where
#0 0xfe5b8545 in __lwp_sigqueue () from /lib/libc.so.1
#1 0xfe5b102f in thr_kill () from /lib/libc.so.1
#2 0xfe4f42da in raise () from /lib/libc.so.1
#3 0xfe4c802e in abort () from /lib/libc.so.1
#4 0x08050c06 in main ()
at
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.c-torture/execute/alias-3.c:15
The problem lies with the assembler: when using /bin/as, this code snippet
.local a
.comm a,4,4
.globl b
.set b,a
results in the following symbol table entries:
[3] 0 0x4 OBJT LOCL D 0 .bss a
[7] 0 0x4 OBJT GLOB D 0 COMMON b
while gas emits
[5] 0 0x4 OBJT LOCL D 0 .bss a
[8] 0 0x4 OBJT GLOB D 0 .bss b
The as output results in two different variables in the executable:
[53] 0x8060e54 0x4 OBJT LOCL D 0 .bss a
[71] 0x8060e58 0x4 OBJT GLOB D 0 .bss b
while with gas, they alias as expected:
[53] 0x8060e54 0x4 OBJT LOCL D 0 .bss a
[71] 0x8060e54 0x4 OBJT GLOB D 0 .bss b
So far, I haven't found any workaround to avoid this as behaviour.
Solaris/SPARC as doesn't show this problem, btw.
Rainer