NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-vax/51967: GCC 5.4 aborts on vax due to SIGILL for cc1
>Number: 51967
>Category: port-vax
>Synopsis: GCC 5.4 aborts on vax due to SIGILL for cc1
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-vax-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 13 22:00:00 +0000 2017
>Originator: Rin Okuyama
>Release: 5.99.59
>Organization:
Faculty of Science and Technology, Keio University
>Environment:
NetBSD vax 7.99.59 NetBSD 7.99.59 (GENERIC) #0: Wed Jan 18 00:10:36 JST 2017 rin@latipes:/var/build/src/sys/arch/vax/compile/obj.vax-vax/GENERIC vax
>Description:
/usr/libexec/cc1 aborts on vax (on simh) via SIGILL when compiling
source codes like this with optimization -O1 or higher:
% cat sample.c
#ifndef USE_CHAR
struct s {
int x;
int pad[10];
} s1, s2;
#else
struct s {
char x;
char pad[36];
} s1, s2;
#endif
int main() {
s1.x = 0;
s2 = s1;
return 0;
}
Then, "cc -O1 sample.c" and "cc -O1 -DUSE_CHAR sample.c" abort:
% cc -v -O1 sample.c
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: vax--netbsdelf
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=vax--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb1 20160606' --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-mpc-lib=/var/obj/mknative/vax/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/vax/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/vax/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/vax --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd7.0 --host=vax--netbsdelf --with-sysroot=/var/obj/mknative/vax/usr/src/destdir.vax
Thread model: posix
gcc version 5.4.0 (nb1 20160606)
COLLECT_GCC_OPTIONS='-v' '-O1'
/usr/libexec/cc1 -quiet -v sample.c -fPIC -quiet -dumpbase sample.c -auxbase sample -O1 -version -o /var/tmp//ccMNFtlG.s
GNU C11 (nb1 20160606) version 5.4.0 (vax--netbsdelf)
compiled by GNU C version 5.4.0, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=34 --param ggc-min-heapsize=8184
#include "..." search starts here:
#include <...> search starts here:
/usr/include/gcc-5
/usr/include
End of search list.
GNU C11 (nb1 20160606) version 5.4.0 (vax--netbsdelf)
compiled by GNU C version 5.4.0, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=34 --param ggc-min-heapsize=8184
Compiler executable checksum: 00fef665a46b5ab23cff11102ac9e396
sample.c: In function 'main':
sample.c:19:1: internal compiler error: Illegal instruction
}
^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
Note that if the size of pad is reduced, this failure does not occur.
According to GDB, SIGILL takes place in check_mem_read_use():
% gdb /usr/libexec/cc1
GNU gdb (GDB) 7.12
...
Reading symbols from /usr/libexec/cc1...(no debugging symbols found)...done.
(gdb) r -quiet -v sample.c -fPIC -quiet -dumpbase sample.c -auxbase sample -O1 -version -o /var/tmp//ccMNFtlG.s
Starting program: /usr/libexec/cc1 -quiet -v sample.c -fPIC -quiet -dumpbase sample.c -auxbase sample -O1 -version -o /var/tmp//ccMNFtlG.s
GNU C11 (nb1 20160606) version 5.4.0 (vax--netbsdelf)
...
Compiler executable checksum: 00fef665a46b5ab23cff11102ac9e396
Program received signal SIGILL, Illegal instruction.
0x00238087 in check_mem_read_use(rtx_def**, void*) (2132440588, 2134585384)
(gdb) bt
#0 0x00238087 in check_mem_read_use(rtx_def**, void*) (2132440588, 2134585384)
#1 0x001c507c in note_uses(rtx_def**, void (*)(rtx_def**, void*), void*)
(2131802444, 2326056, 2134585384)
#2 0x001c5032 in note_uses(rtx_def**, void (*)(rtx_def**, void*), void*)
(2131822400, 2326056, 2134585384)
#3 0x00239ce3 in (anonymous namespace)::pass_rtl_dse2::execute(function*)
(2134141248, 2131783780)
#4 0x00205512 in execute_one_pass(opt_pass*) (2134141248)
#5 0x002058ae in execute_pass_list_1(opt_pass*) [clone .constprop.62]
(2134139712)
#6 0x002058be in execute_pass_list_1(opt_pass*) [clone .constprop.62]
(2134114560)
#7 0x002058f7 in execute_pass_list(function*, opt_pass*)
(2131783780, 2134114560)
#8 0x0046c3c1 in cgraph_node::expand() (2132414464)
#9 0x0046d5d6 in symbol_table::compile() (2131783680)
#10 0x0046e757 in symbol_table::finalize_compilation_unit() (2131783680)
#11 0x0002885d in c_write_global_declarations() ()
#12 0x0019ce0c in compile_file() ()
#13 0x00706b3f in toplev::main(int, char**) (2147478798, 14, 2147478896)
#14 0x0070617d in main (14, 2147478896, 2147478956)
(gdb)
>How-To-Repeat:
Described above.
>Fix:
As a workaround, compile check_mem_read_use() in dse.c with -O0:
====
--- src/external/gpl3/gcc/usr.bin/backend/Makefile.orig 2017-02-14 06:45:14.671215727 +0900
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile 2017-02-14 06:44:58.249596141 +0900
@@ -461,6 +461,7 @@
COPTS.builtins.c+=-O0
COPTS.convert.c+=-O0
COPTS.dwarf2out.c+=-O0
+COPTS.dse.c+=-O0
COPTS.expmed.c+=-O0
COPTS.expr.c+=-O0
COPTS.fixed-value.c+=-O0
====
Then, the sample code above can be successfully compiled.
Home |
Main Index |
Thread Index |
Old Index