Bug 531385 - internal compiler error: in simplify_subreg, at simplify-rtx.c:5055
Summary: internal compiler error: in simplify_subreg, at simplify-rtx.c:5055
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 12
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-28 00:22 UTC by Kevin O'Connor
Modified: 2010-04-12 15:54 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-04-12 15:54:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kevin O'Connor 2009-10-28 00:22:50 UTC
Description of problem:

The compiler on fc12 beta (gcc (GCC) 4.4.1 20091008 (Red Hat 4.4.1-20)) returns an internal error when compiling my program (SeaBIOS).  The latest compiler from rawhide (gcc (GCC) 4.4.2 20091018 (Red Hat 4.4.2-4)) also has the same issue.

Version-Release number of selected component (if applicable):

gcc (GCC) 4.4.1 20091008 (Red Hat 4.4.1-20)
gcc (GCC) 4.4.2 20091018 (Red Hat 4.4.2-4)

How reproducible:

Every time

Steps to Reproduce:
1. git clone git.linuxtogo.org:/home/kevin/seabios.git
2. cd seabios
3. git checkout c604f2f6be0ad729c8e25958c946a8535ca391ee
4. make V=1
  
Actual results:

src/util.c: In function ‘__end_thread’:
src/util.c:183: internal compiler error: in simplify_subreg, at simplify-rtx.c:5055
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Expected results:

I expected the program to compile successfully.

Additional info:

This program compiles okay on fc11 (gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)).  It is also okay on vanilla gcc v4.4.2.

The program is using several compiler options include -fwhole-program and -combine.  Playing with these options can make the internal bug go away.

Comment 1 Jakub Jelinek 2009-10-28 07:47:54 UTC
GCC should have prepared a preprocessed testcase for you, please provide it.  If it has not, please prepare it yourself.
In any case, don't use -combine, it is known to be broken.

Comment 2 Kevin O'Connor 2009-10-31 01:13:34 UTC
Gcc did not provide a test case.  I have come up with a test case:

============================================================
cat > file1.c << EOF
struct s1_s {
    int v;
};
struct s1_s g1;
void __attribute__((externally_visible)) func1() {
    struct s1_s *l1 = &g1;
}
EOF

cat > file2.c << EOF
extern struct s1_s g1;
void func2() {
    &g1;
}
EOF

cc -O -g -fwhole-program -combine -c file1.c file2.c
============================================================

Comment 3 Segher Boessenkool 2009-10-31 19:21:19 UTC
It happens on GCC mainline as well, filed there as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41893

Comment 4 Jakub Jelinek 2009-11-09 16:15:36 UTC
Should be fixed in gcc-4.4.2-8 and later.

Comment 5 Kevin O'Connor 2010-01-03 20:04:41 UTC
This came back in FC12:

$ rpm -q gcc
gcc-4.4.2-20.fc12.x86_64

The test case above no longer causes the problem - but simply changing the test case to also assign a value to the variable shows the problem.

New test case:

============================================================
cat > file1.c << EOF
struct s1_s {
    int v;
};
struct s1_s g1;
void __attribute__((externally_visible)) func1() {
    struct s1_s *l1 = &g1;
    l1->v = 0;
}
EOF

cat > file2.c << EOF
extern struct s1_s g1;
void func2() {
    &g1;
}
EOF

cc -O -g -fwhole-program -combine -c file1.c file2.c
============================================================

Comment 6 Jakub Jelinek 2010-04-12 15:54:05 UTC
Should be fixed in gcc-4.4.3-14 and above.


Note You need to log in before you can comment on or make changes to this bug.