Bug 1212265

Summary: internal compiler error: in extract_insn, at recog.c:2154
Product: Red Hat Enterprise Linux 7 Reporter: Daniel Villeneuve <dvilleneuve>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Miroslav Franc <mfranc>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: dvilleneuve, mcermak, mfranc, mpolacek, ohudlick
Target Milestone: rc   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.8.5-1.el7 Doc Type: Bug Fix
Doc Text:
A bug in TLS handling on 32-bit Intel and AMD architectures caused that the compiler was trying to use %gs: or %fs: segment registers with the Load Effective Address (LEA) instruction. Consequently, a crash could occur in code with __thread arrays of structures or long long integers. This bug has been fixed, and the code compiles correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:22:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The source file with minimal external dependencies (#include <string.h>)
none
The preprocessed file as produced by gcc. none

Description Daniel Villeneuve 2015-04-16 03:33:24 UTC
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:

Comment 1 Daniel Villeneuve 2015-04-16 03:35:26 UTC
Created attachment 1015012 [details]
The preprocessed file as produced by gcc.

Comment 2 Daniel Villeneuve 2015-04-16 03:36:53 UTC
Using memcpy instead of structure assignment circumvents the problem.

Comment 4 Daniel Villeneuve 2015-04-16 03:39:24 UTC
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)

Comment 5 Daniel Villeneuve 2015-04-16 03:40:40 UTC
The problem also occurs with a freshly compiled gcc-4.8.4.

Comment 6 Marek Polacek 2015-04-16 06:24:22 UTC
I could reproduce this even with the mainline gcc, so there's nothing to backport at the moment.

Comment 7 Jakub Jelinek 2015-06-09 08:39:02 UTC
Reduced testcase:
extern __thread struct S { int a, b; } a[10];
struct S foo (int b) { return a[b]; }

Comment 9 Jakub Jelinek 2015-06-10 09:40:57 UTC
Fix committed upstream.

Comment 13 errata-xmlrpc 2015-11-19 12:22:57 UTC
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