This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/3875: gcc 3.0 breaks Mercury

>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
>Originator:     Fergus Henderson
>Release:        3.0
Comp Sci, University of Melbourne
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

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.


Compile the following file with `gcc -O'.

	extern void *dummy;
	void foo (void) {
	  goto *&&label1;
	  dummy = &&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:> 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)) ==
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,
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)))


A work-around is to compile without optimization.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]