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.
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.
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 ============================================================
It happens on GCC mainline as well, filed there as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41893
Should be fixed in gcc-4.4.2-8 and later.
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 ============================================================
Should be fixed in gcc-4.4.3-14 and above.