http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54177

             Bug #: 54177
           Summary: [4.8 Regression]: Segfault in cselib_lookup due to
                    NULL_RTX passed from vt_add_function_parameter
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ubiz...@gmail.com
            Target: alpha-linux-gnu


Current gcc [1] fails following testcase on alpha-linux-gnu:

FAIL: gcc.c-torture/compile/compound-literal-3.c  -O3 -g  (internal compiler
error)
FAIL: gcc.c-torture/compile/compound-literal-3.c  -O3 -g  (test for excess
errors)

This bug can be triggered by a crosscompiler to alpha-linux-gnu:

(gdb) r
Starting program: /home/uros/gcc-build-alpha/gcc/cc1 -O3 -g -quiet
compound-literal-3.c

Program received signal SIGSEGV, Segmentation fault.
cselib_lookup (x=0x0, mode=SCmode, create=create@entry=1,
memmode=memmode@entry=VOIDmode) at ../../gcc-svn/trunk/gcc/cselib.c:2092
2092      cselib_val *ret = cselib_lookup_1 (x, mode, create, memmode);

(gdb) bt
#0  cselib_lookup (x=0x0, mode=SCmode, create=create@entry=1,
memmode=memmode@entry=VOIDmode) at ../../gcc-svn/trunk/gcc/cselib.c:2092
#1  0x00000000005b4cda in cselib_lookup_from_insn (x=<optimized out>,
mode=<optimized out>, create=create@entry=1, memmode=memmode@entry=VOIDmode,
insn=insn@entry=0x7ffff1aab1c0)
    at ../../gcc-svn/trunk/gcc/cselib.c:2078
#2  0x0000000000a2afd6 in vt_add_function_parameter
(parm=parm@entry=0x7ffff1aa7080) at ../../gcc-svn/trunk/gcc/var-tracking.c:9437
#3  0x0000000000a2b630 in vt_add_function_parameters () at
../../gcc-svn/trunk/gcc/var-tracking.c:9509
#4  vt_initialize () at ../../gcc-svn/trunk/gcc/var-tracking.c:9765
#5  0x0000000000a34df7 in variable_tracking_main_1 () at
../../gcc-svn/trunk/gcc/var-tracking.c:10009

(gdb) f 2
#2  0x0000000000a2afd6 in vt_add_function_parameter
(parm=parm@entry=0x7ffff1aa7080) at ../../gcc-svn/trunk/gcc/var-tracking.c:9437
9437          val = cselib_lookup_from_insn (var_lowpart (mode, incoming),
mode, true,

(gdb) p debug_rtx (incoming)
(concat:SC (reg:SF 48 $f16 [ x ])
    (reg:SF 49 $f17 [ x+4 ]))
$1 = void

(gdb) p mode
$2 = SCmode

var_lowpart can hadle only REG_P and MEM_P operands. However, we are already in
SCmode, so there is no need to call it at all.

[1]

Compiler version: 4.8.0 20120804 (experimental) [trunk revision 190144] (GCC) 
Platform: alphaev68-unknown-linux-gnu

Reply via email to