This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/3875: gcc 3.0 breaks Mercury
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/3875: gcc 3.0 breaks Mercury
- From: Fergus Henderson <fjh at mars dot cs dot mu dot oz dot au>
- Date: Mon, 30 Jul 2001 22:15:39 +1000
>Number: 3875
>Category: c
>Synopsis: gcc 3.0 breaks Mercury
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Mon Jul 30 05:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Fergus Henderson
>Release: 3.0
>Organization:
Comp Sci, University of Melbourne
>Environment:
System: Linux mars 2.2.18pre21-ide #1 Sat Nov 18 19:41:46 EST 2000 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/usr/local/gcc-3.0
>Description:
gcc 3.0 gets a segmentation fault when compiling C files generated by
the Mercury compiler.
The problem seems to be related to taking the address of an unreachable label.
>How-To-Repeat:
Compile the following file with `gcc -O'.
extern void *dummy;
void foo (void) {
goto *&&label1;
label1:
dummy = &&label2;
return;
label2:
goto label2;
}
The result is a crash in cc1
bash$ gcc -O bug.c
bug.c: In function `foo':
bug.c:9: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
The crash occurs in find_basic_blocks_1().
(gdb) list *$pc
0x8149da4 is in find_basic_blocks_1 (flow.c:873).
868 || GET_CODE (PATTERN (next)) ==
ADDR_DIFF_VEC))
869 ;
870 else if (GET_CODE (lab) == NOTE)
871 ;
872 else if (GET_CODE (NEXT_INSN (insn)) == JUMP_INSN
873 && find_reg_note (NEXT_INSN (insn), REG_LABEL,
lab))
874 ;
875 else
876 lvl = alloc_EXPR_LIST (0, XEXP (note, 0), lvl);
877 }
(gdb) p insn
$5 = 0x401675c0
(gdb) pr
(insn 15 27 0 (set (mem/f:SI (symbol_ref:SI ("dummy")) 0)
(label_ref:SI 19)) 35 {*movsi_1} (nil)
(insn_list:REG_LABEL 19 (nil)))
>Fix:
A work-around is to compile without optimization.
>Release-Note:
>Audit-Trail:
>Unformatted: