User account creation filtered due to spam.

Bug 59261

Summary: [4.9 regression] FAIL: gcc.dg/vect/bb-slp-26.c -flto -ffat-lto-objects (internal compiler error)
Product: gcc Reporter: Andreas Schwab <schwab>
Component: middle-endAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: jakub, law
Priority: P2 Keywords: ice-on-valid-code
Version: 4.9.0   
Target Milestone: 4.9.0   
Host: Target: ia64-*-*
Build: Known to work:
Known to fail: Last reconfirmed: 2014-01-28 00:00:00
Attachments: Intermediate files from -save-temps
gcc49-pr59261.patch

Description Andreas Schwab 2013-11-23 09:24:54 UTC
$ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.dg/vect/bb-slp-26.c -flto -ffat-lto-objects -ftree-vectorize -fno-vect-cost-model -fno-common -O2 
../gcc/testsuite/gcc.dg/vect/bb-slp-26.c: In function ‘main’:
../gcc/testsuite/gcc.dg/vect/bb-slp-26.c:19:14: internal compiler error: in expand_shift_1, at expmed.c:2247
       dst[0] += A*src[0] + src[stride];
              ^
0x40000000003db5bf expand_shift_1
        ../../gcc/expmed.c:2247
0x40000000003e55ef expand_mult_const
        ../../gcc/expmed.c:2937
0x40000000003e6e7f expand_mult(machine_mode, rtx_def*, rtx_def*, rtx_def*, int)
        ../../gcc/expmed.c:3195
0x4000000000423a7f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc/expr.c:8510
0x4000000000400d4f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:10556
0x4000000000403f0f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:9365
0x40000000004141cf expand_expr
        ../../gcc/expr.h:453
0x40000000004141cf expand_operands
        ../../gcc/expr.c:7516
0x400000000041c11f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc/expr.c:8340
0x4000000000400d4f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:10556
0x4000000000403f0f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:9365
0x40000000003fe85f expand_expr
        ../../gcc/expr.h:453
0x40000000003fe85f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:10343
0x4000000000403f0f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**)
        ../../gcc/expr.c:9365
0x40000000004154df store_expr(tree_node*, rtx_def*, int, bool)
        ../../gcc/expr.c:5306
0x400000000041859f expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc/expr.c:5092
0x400000000023c8af expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3199
0x400000000023c8af expand_gimple_stmt
        ../../gcc/cfgexpand.c:3295
0x400000000023fdcf expand_gimple_basic_block
        ../../gcc/cfgexpand.c:5135
0x4000000000243eef gimple_expand_cfg
        ../../gcc/cfgexpand.c:5701
Comment 1 Jeffrey A. Law 2014-01-28 06:30:50 UTC
I can't get this to fail either on the tip of the trunk or r205320.

Are you still seeing this failure?
Comment 2 Andreas Schwab 2014-01-28 13:29:43 UTC
http://gcc.gnu.org/ml/gcc-testresults/2014-01/msg02171.html

It still fails the same.

There's a similar ICE in gcc.dg/vect/pr37539.c -flto -ffat-lto-objects:

$ gcc/xgcc -Bgcc/ ../gcc/testsuite/gcc.dg/vect/pr37539.c -fno-diagnostics-show-caret -fdiagnostics-color=never -flto -ffat-lto-objects -ftree-vectorize -fno-vect-cost-model -fno-common -O2 -fdump-tree-vect-details -lm -o ./pr37539.exe
../gcc/testsuite/gcc.dg/vect/pr37539.c: In function ‘ayuv2yuyv_ref’:
../gcc/testsuite/gcc.dg/vect/pr37539.c:16:19: internal compiler error: in expand_expr_real_2, at expr.c:9109
0x400000000056144f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc/expr.c:9109
0x400000000037bdcf expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3249
0x400000000037bdcf expand_gimple_stmt
        ../../gcc/cfgexpand.c:3309
0x400000000037ca3f expand_gimple_basic_block
        ../../gcc/cfgexpand.c:5149
0x4000000000383f0f gimple_expand_cfg
        ../../gcc/cfgexpand.c:5715
0x4000000000383f0f execute
        ../../gcc/cfgexpand.c:5935
Comment 3 Jeffrey A. Law 2014-01-28 14:22:14 UTC
Can you include -v on your command line.  It'd also be helpful if you could include the intermediates generated by -save-temps.
Comment 4 Andreas Schwab 2014-01-28 16:28:33 UTC
$ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.dg/vect/bb-slp-26.c -flto -ffat-lto-objects -ftree-vectorize -fno-vect-cost-model -fno-common -O2 -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: ia64-suse-linux
Configured with: ../configure --prefix=/usr --build=ia64-suse-linux --host=ia64-suse-linux --enable-checking=release --enable-shared --with-system-zlib CFLAGS='-O2 -g' CXXFLAGS='-O2 -g'
Thread model: posix
gcc version 4.9.0 20140128 (experimental) [trunk revision 207160] (GCC) 
COLLECT_GCC_OPTIONS='-B' 'gcc/' '-flto' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v'
 gcc/cc1 -quiet -v -iprefix /usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/ia64-suse-linux/4.9.0/ -isystem gcc/include -isystem gcc/include-fixed ../gcc/testsuite/gcc.dg/vect/bb-slp-26.c -quiet -dumpbase bb-slp-26.c -auxbase bb-slp-26 -O2 -version -flto -ffat-lto-objects -ftree-vectorize -fvect-cost-model=unlimited -fno-common -o /tmp/ccnI2B5p.s
GNU C (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/ia64-suse-linux/4.9.0/include"
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/ia64-suse-linux/4.9.0/include-fixed"
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/ia64-suse-linux/4.9.0/../../../../ia64-suse-linux/include"
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/../../lib/gcc/ia64-suse-linux/4.9.0/include"
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/../../lib/gcc/ia64-suse-linux/4.9.0/include-fixed"
ignoring nonexistent directory "/usr/local/gcc/gcc-20140128/Build/gcc/../lib/gcc/../../lib/gcc/ia64-suse-linux/4.9.0/../../../../ia64-suse-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 gcc/include
 gcc/include-fixed
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9ec120f50573ca1e0b5055cf7d3946d0
COLLECT_GCC_OPTIONS='-B' 'gcc/' '-flto' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v'
 gcc/as -v -x -o /tmp/ccIBjE6p.o /tmp/ccnI2B5p.s
GNU assembler version 2.23.1 (ia64-suse-linux) using BFD version (GNU Binutils; SUSE Linux Enterprise 11) 2.23.1
COMPILER_PATH=gcc/
LIBRARY_PATH=gcc/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-B' 'gcc/' '-flto' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v'
 gcc/collect2 -plugin gcc/liblto_plugin.so -plugin-opt=gcc/lto-wrapper -plugin-opt=-fresolution=/tmp/ccAVXv8p.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lunwind -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lunwind -flto -dynamic-linker /lib/ld-linux-ia64.so.2 /usr/lib/crt1.o /usr/lib/crti.o gcc/crtbegin.o -Lgcc /tmp/ccIBjE6p.o -lgcc --as-needed -lgcc_s -lunwind --no-as-needed -lc -lgcc --as-needed -lgcc_s -lunwind --no-as-needed gcc/crtend.o /usr/lib/crtn.o
 gcc/xgcc @/tmp/cc8GnggF.args
Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
Target: ia64-suse-linux
Configured with: ../configure --prefix=/usr --build=ia64-suse-linux --host=ia64-suse-linux --enable-checking=release --enable-shared --with-system-zlib CFLAGS='-O2 -g' CXXFLAGS='-O2 -g'
Thread model: posix
gcc version 4.9.0 20140128 (experimental) [trunk revision 207160] (GCC) 
COLLECT_GCC_OPTIONS='-c' '-B' 'gcc/' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v' '-fltrans-output-list=/tmp/cceMmjdF.ltrans.out' '-fwpa' '-fresolution=/tmp/ccAVXv8p.res'
 gcc/lto1 -quiet -dumpbase ccIBjE6p.o -auxbase ccIBjE6p -O2 -version -ffat-lto-objects -ftree-vectorize -fvect-cost-model=unlimited -fno-common -fltrans-output-list=/tmp/cceMmjdF.ltrans.out -fwpa -fresolution=/tmp/ccAVXv8p.res @/tmp/ccDZYbNE
GNU GIMPLE (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COMPILER_PATH=gcc/:gcc/
LIBRARY_PATH=gcc/:gcc/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-B' 'gcc/' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v' '-fltrans-output-list=/tmp/cceMmjdF.ltrans.out' '-fwpa' '-fresolution=/tmp/ccAVXv8p.res'
 gcc/xgcc @/tmp/ccOQeYmF.args
Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
Target: ia64-suse-linux
Configured with: ../configure --prefix=/usr --build=ia64-suse-linux --host=ia64-suse-linux --enable-checking=release --enable-shared --with-system-zlib CFLAGS='-O2 -g' CXXFLAGS='-O2 -g'
Thread model: posix
gcc version 4.9.0 20140128 (experimental) [trunk revision 207160] (GCC) 
COLLECT_GCC_OPTIONS='-c' '-B' 'gcc/' '-ffat-lto-objects' '-ftree-vectorize' '-fvect-cost-model=unlimited' '-fno-common' '-O2' '-v' '-fltrans-output-list=/tmp/cceMmjdF.ltrans.out' '-fltrans' '-o' '/tmp/cceMmjdF.ltrans0.ltrans.o'
 gcc/lto1 -quiet -dumpbase cceMmjdF.ltrans0.o -auxbase-strip /tmp/cceMmjdF.ltrans0.ltrans.o -O2 -version -ffat-lto-objects -ftree-vectorize -fvect-cost-model=unlimited -fno-common -fltrans-output-list=/tmp/cceMmjdF.ltrans.out -fltrans @/tmp/ccxXeTwH -o /tmp/cc7D4GAH.s
GNU GIMPLE (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 4.9.0 20140128 (experimental) [trunk revision 207160] (ia64-suse-linux)
        compiled by GNU C version 4.9.0 20140128 (experimental) [trunk revision 207160], GMP version 4.3.2, MPFR version 2.4.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
../gcc/testsuite/gcc.dg/vect/bb-slp-26.c: In function ‘main’:
../gcc/testsuite/gcc.dg/vect/bb-slp-26.c:19:14: internal compiler error: in expand_shift_1, at expmed.c:2315
       dst[0] += A*src[0] + src[stride];
Comment 5 Andreas Schwab 2014-01-28 16:31:28 UTC
Created attachment 31969 [details]
Intermediate files from -save-temps
Comment 6 Jeffrey A. Law 2014-01-28 19:36:22 UTC
Thanks.  I've managed to reproduce the failure using those intermediate files.  However, I haven't managed to trigger the failure directly from source.

What's happening is we're getting into expand_shift_1:

Breakpoint 3, expand_shift_1 (code=LSHIFT_EXPR, mode=V8QImode, shifted=0x200000000416e0e0, amount=0x2000000004010410, target=0x0, unsignedp=0)

The amount is (const_int 1)


V8Q8mode isn't a valid shift mode for the ia64 target (mode iterator for the shifts uses VECINT24).  Since there isn't a pattern for this, no libcall and the generic bits don't know how to synthesize the shift, we trip the assertion and die.

We get into this code trying to expand:

<mult_expr 0x200000000414cac8
    type <vector_type 0x20000000041513b0
        type <integer_type 0x20000000040e2028 public unsigned QI
            size <integer_cst 0x2000000004029b80 constant 8>
            unit size <integer_cst 0x2000000004029ba0 constant 1>
            align 8 symtab 0 alias set 0 canonical type 0x20000000040e2028 precision 8 min <integer_cst 0x200000000402b300 0> max <integer_cst 0x200000000402b320 255>>
        unsigned V8QI
        size <integer_cst 0x20000000040299c0 constant 64>
        unit size <integer_cst 0x20000000040299e0 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x20000000041513b0 nunits 8>
   
    arg 0 <ssa_name 0x2000000004142178 type <vector_type 0x20000000041513b0>
        visited var <var_decl 0x200000000401dc80 vect__34.18>def_stmt vect__34.18_241 = VIEW_CONVERT_EXPR<vector(8) unsigned char>(vect__33.17_242);

        version 241>
    arg 1 <vector_cst 0x200000000413e300 type <vector_type 0x20000000041513b0>
        constant
        elt0:  <integer_cst 0x200000000402b500 constant 3> elt1:  <integer_cst 0x200000000402b500 3> elt2:  <integer_cst 0x200000000402b500 3> elt3:  <integer_cst 0x200000000402b500 3> elt4:  <integer_cst 0x200000000402b500 3> elt5:  <integer_cst 0x200000000402b500 3> elt6:  <integer_cst 0x200000000402b500 3> elt7:  <integer_cst 0x200000000402b500 3>>
    ../gcc/testsuite/gcc.dg/vect/bb-slp-26.c:19:14>


Clearly expanding a V8QImode multiply using a shift is a bad idea on Itanic.  What I don't see is how to stop the code form using shifts like this.

Regardless, the bug is confirmed, but given it's Itanic, it's certainly not worthy of P1 status.
Comment 7 Jakub Jelinek 2014-02-03 18:18:38 UTC
Created attachment 32031 [details]
gcc49-pr59261.patch

Untested fix (well, tested with a cross that it does ICE on this testcase without it and doesn't with it).
Comment 8 Andreas Schwab 2014-02-04 08:37:01 UTC
http://gcc.gnu.org/ml/gcc-testresults/2014-02/msg00179.html

No regressions and the testcase works now.
Comment 9 Jakub Jelinek 2014-02-04 09:36:50 UTC
Author: jakub
Date: Tue Feb  4 09:36:18 2014
New Revision: 207456

URL: http://gcc.gnu.org/viewcvs?rev=207456&root=gcc&view=rev
Log:
	PR middle-end/59261
	* expmed.c (expand_mult): For MODE_VECTOR_INT multiplication
	if there is no vashl<mode>3 or ashl<mode>3 insn, skip_synth.

	* gcc.dg/pr59261.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr59261.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog
Comment 10 Jakub Jelinek 2014-02-04 09:37:27 UTC
Fixed then.