Created attachment 1015011 [details] The source file with minimal external dependencies (#include <string.h>) Description of problem: compilation in 32-bit mode produces a compiler error Version-Release number of selected component (if applicable): How reproducible: compile the attached source file Steps to Reproduce: 1. gcc -m32 -o bug.o -c bug.c 2. 3. Actual results: bartok[daniel/bug-gcc] 0 $ gcc -m32 -o bug.o -c bug.c bug.c: In function ‘roll’: bug.c:22:1: error: unrecognizable insn: } ^ (insn 47 15 48 3 (set (reg:SI 1 dx [+4 ]) (plus:SI (plus:SI (mult:SI (reg:SI 1 dx [orig:60 D.1887 ] [60]) (const_int 8 [0x8])) (unspec:SI [ (const_int 0 [0]) ] UNSPEC_TP)) (reg:SI 0 ax [72]))) bug.c:18 -1 (nil)) bug.c:22:1: internal compiler error: in extract_insn, at recog.c:2154 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/cctbg6tl.out file, please attach this to your bugreport. Expected results: A correctly compiled file. Additional info:
Created attachment 1015012 [details] The preprocessed file as produced by gcc.
Using memcpy instead of structure assignment circumvents the problem.
The gcc version used: bartok[daniel/bug-gcc] 0 $ gcc --version; echo; gcc -v gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.3/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
The problem also occurs with a freshly compiled gcc-4.8.4.
I could reproduce this even with the mainline gcc, so there's nothing to backport at the moment.
Reduced testcase: extern __thread struct S { int a, b; } a[10]; struct S foo (int b) { return a[b]; }
Fix committed upstream.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2080.html