[backport from gcc-4.9/trunk r197003 ] List-Archive: From: Eric Botcazou Subject: Fix RTL checking failure in return value code Date: Sat, 23 Mar 2013 12:12:02 +0100 We ran into RTL checking failure on the 4.7 branch for ARM (BE/VFPv3/ARM): FAIL: gcc.c-torture/execute/vector-subscript-1.c compilation, -O0 (internal compiler error) UNRESOLVED: gcc.c-torture/execute/vector-subscript-1.c execution, -O0 FAIL: gcc.c-torture/execute/vector-subscript-2.c compilation, -O0 (internal compiler error) UNRESOLVED: gcc.c-torture/execute/vector-subscript-2.c execution, -O0 The code in expand_function_end: /* If a non-BLKmode return value should be padded at the least significant end of the register, shift it left by the appropriate amount. BLKmode results are handled using the group load/store machinery. */ if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode && targetm.calls.return_in_msb (TREE_TYPE (decl_result))) { emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl), REGNO (real_decl_rtl)), decl_rtl); shift_return_value (GET_MODE (decl_rtl), true, real_decl_rtl); } is taking REGNO of a PARALLEL: (parallel/i:TI [ (expr_list:REG_DEP_TRUE (reg:DI 63 s0) (const_int 0 [0])) (expr_list:REG_DEP_TRUE (reg:DI 65 s2) (const_int 8 [0x8])) ]) Fixed thusly, tested on x86_64-suse-linux, applied on the mainline as obvious. gcc/ 2013-03-23 Eric Botcazou * calls.c (expand_call): Add missing guard to code handling return of non-BLKmode structures in MSB. * function.c (expand_function_end): Likewise. --- gcc-4.8.0/gcc/calls.c.~1~ 2013-01-12 00:39:18.000000000 +0100 +++ gcc-4.8.0/gcc/calls.c 2013-03-23 20:33:34.495313384 +0100 @@ -3171,7 +3171,9 @@ expand_call (tree exp, rtx target, int i group load/store machinery below. */ if (!structure_value_addr && !pcc_struct_value + && TYPE_MODE (rettype) != VOIDmode && TYPE_MODE (rettype) != BLKmode + && REG_P (valreg) && targetm.calls.return_in_msb (rettype)) { if (shift_return_value (TYPE_MODE (rettype), false, valreg)) --- gcc-4.8.0/gcc/function.c.~1~ 2013-03-09 08:54:02.000000000 +0100 +++ gcc-4.8.0/gcc/function.c 2013-03-23 20:33:34.495313384 +0100 @@ -5093,6 +5093,7 @@ expand_function_end (void) amount. BLKmode results are handled using the group load/store machinery. */ if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode + && REG_P (real_decl_rtl) && targetm.calls.return_in_msb (TREE_TYPE (decl_result))) { emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),