Bug 96028 - [11 Regression] SEGV in vect_create_constant_vectors
Summary: [11 Regression] SEGV in vect_create_constant_vectors
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 11.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-02 09:18 UTC by Rainer Orth
Modified: 2020-07-02 12:39 UTC (History)
1 user (show)

See Also:
Host: sparc-sun-solaris2.11
Target: sparc-sun-solaris2.11
Build: sparc-sun-solaris2.11
Known to work:
Known to fail:
Last reconfirmed: 2020-07-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2020-07-02 09:18:45 UTC
The new gcc.dg/torture/pr95761.c test causes an ICE on 64-bit Solaris/SPARC:

+FAIL: gcc.dg/torture/pr95761.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler error)
+FAIL: gcc.dg/torture/pr95761.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
+FAIL: gcc.dg/torture/pr95761.c   -O3 -g  (internal compiler error)
+FAIL: gcc.dg/torture/pr95761.c   -O3 -g  (test for excess errors)

Excess errors:
during GIMPLE pass: slp
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/torture/pr95761.c:12:6: internal compiler error: Segmentation Fault
0xc55d0b crash_signal
        /vol/gcc/src/hg/master/local/gcc/toplev.c:328
0xf86164 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
        /vol/gcc/src/hg/master/local/gcc/tree.h:3414
0xf86164 vect_create_constant_vectors
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3699
0xf86d4f vect_schedule_slp_instance
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4314
0xf86d4f vect_schedule_slp_instance
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4314
0xf8f14f vect_schedule_slp(vec_info*)
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4554
0xf9002f vect_slp_bb_region
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3379
0xf9002f vect_slp_bb(basic_block_def*)
        /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3509
0xf91e0f execute
        /vol/gcc/src/hg/master/local/gcc/tree-vectorizer.c:1384

Can be reproduced with

$ cc1 -fpreprocessed pr95761.i -quiet -m64 -O3 -o pr95761.s

gdb shows
Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
vect_create_constant_vectors (vinfo=0x1bc5f38, op_node=<optimized out>)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3699
3699		  if (!types_compatible_p (TREE_TYPE (vector_type), TREE_TYPE (op)))
(gdb) p vector_type
$1 = <vector_type 0xfa8835c0>
(gdb) p op
$2 = <tree 0x0>
(gdb) where
#0  vect_create_constant_vectors (vinfo=0x1bc5f38, op_node=<optimized out>)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3699
#1  0x00f86d50 in vect_schedule_slp_instance (vinfo=0x1bc5f38, node=0x1beab48, 
    instance=0x1a95680)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4314
#2  0x00f86d50 in vect_schedule_slp_instance (vinfo=0x1bc5f38, node=0x1bea748, 
    instance=0x1a95680)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4314
#3  0x00f8f150 in vect_schedule_slp (vinfo=0x1bc5f38)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:4554
#4  0x00f90030 in vect_slp_bb_region (n_stmts=<optimized out>, datarefs=..., 
    region_end=..., region_begin=...)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3379
#5  vect_slp_bb (bb=<optimized out>)
    at /vol/gcc/src/hg/master/local/gcc/tree-vect-slp.c:3509
#6  0x00f91e10 in (anonymous namespace)::pass_slp_vectorize::execute (
    this=<optimized out>, fun=0xfa8ac000)
    at /vol/gcc/src/hg/master/local/gcc/tree-vectorizer.c:1384
#7  0x00b4264c in execute_one_pass (pass=<opt_pass* 0x1a9c8b0 "slp"(172)>)
    at /vol/gcc/src/hg/master/local/gcc/passes.c:2502
#8  0x00b430f4 in execute_pass_list_1 (pass=<opt_pass* 0x1a9c8b0 "slp"(172)>)
    at /vol/gcc/src/hg/master/local/gcc/passes.c:2590
#9  0x00b43118 in execute_pass_list_1 (pass=<opt_pass* 0x1a9c268 "loop"(147)>)
    at /vol/gcc/src/hg/master/local/gcc/passes.c:2591
#10 0x00b43118 in execute_pass_list_1 (pass=<opt_pass* 0x1a9b590 "*all_optimizations"(-1)>) at /vol/gcc/src/hg/master/local/gcc/passes.c:2591
#11 0x00b4316c in execute_pass_list (fn=0xfa8ac000, pass=<opt_pass* 0x1a9b410 "fixup_cfg"(94)>) at /vol/gcc/src/hg/master/local/gcc/passes.c:2601
#12 0x006dbd48 in cgraph_node::expand (this=<cgraph_node * const 0xfa8100d8 "k"/2>) at /vol/gcc/src/hg/master/local/gcc/context.h:48
#13 0x006dd548 in expand_all_functions () at /vol/gcc/src/hg/master/local/gcc/cgraphunit.c:2472
#14 symbol_table::compile (this=0xfa810000) at /vol/gcc/src/hg/master/local/gcc/cgraphunit.c:2823
#15 0x006e092c in symbol_table::compile (this=0xfa810000) at /vol/gcc/src/hg/master/local/gcc/cgraphunit.c:3003
#16 symbol_table::finalize_compilation_unit (this=0xfa810000) at /vol/gcc/src/hg/master/local/gcc/cgraphunit.c:3003
#17 0x00c56218 in compile_file () at /vol/gcc/src/hg/master/local/gcc/toplev.c:483
#18 0x00c58b9c in do_compile () at /vol/gcc/src/hg/master/local/gcc/toplev.c:2307
#19 toplev::main (this=0xffbfe97e, argc=<optimized out>, argv=<optimized out>) at /vol/gcc/src/hg/master/local/gcc/toplev.c:2446
#20 0x015fed9c in main (argc=8, argv=0xffbfe9e4) at /vol/gcc/src/hg/master/local/gcc/main.c:39
Comment 1 Richard Biener 2020-07-02 09:22:51 UTC
I'll have a look with a cross.
Comment 2 Richard Biener 2020-07-02 09:27:29 UTC
Do I need some special flags?

> /tmp/obj/gcc/xgcc -B/tmp/obj/gcc/ /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/torture/pr95761.c    -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never  -fdiagnostics-urls=never    -O0   -S -o pr95761.s -O3 -g -v
Reading specs from /tmp/obj/gcc/specs
COLLECT_GCC=/tmp/obj/gcc/xgcc
Target: sparc-sun-solaris2.11
Configured with: /home/rguenther/src/gcc3/configure --target=sparc-sun-solaris2.11
...
 /tmp/obj/gcc/cc1 -quiet -v -iprefix /tmp/obj/gcc/../lib64/gcc/sparc-sun-solaris2.11/11.0.0/ -isystem /tmp/obj/gcc/include -isystem /tmp/obj/gcc/include-fixed -D__sparcv8 /home/rguenther/src/gcc3/gcc/testsuite/gcc.dg/torture/pr95761.c -quiet -dumpbase pr95761.c -dumpbase-ext .c -mcpu=v9 -g -O0 -O3 -version -fdiagnostics-color=never -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-urls=never -o pr95761.s
<OK>
Comment 3 ro@CeBiTec.Uni-Bielefeld.DE 2020-07-02 09:29:12 UTC
> --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
> Do I need some special flags?

The -m64 is crucial: the test PASSes for me for the default -m32.
Comment 4 Richard Biener 2020-07-02 09:32:02 UTC
(In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #3)
> > --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
> > Do I need some special flags?
> 
> The -m64 is crucial: the test PASSes for me for the default -m32.

Ah, that was it!
Comment 5 Richard Biener 2020-07-02 09:52:30 UTC
Patch in testing.
Comment 6 GCC Commits 2020-07-02 12:38:51 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:105ecbea5f402713130fef4d41bb000e2d23493b

commit r11-1788-g105ecbea5f402713130fef4d41bb000e2d23493b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 2 11:45:06 2020 +0200

    tree-optimization/96028 - fix bogus externalizing of SLP node
    
    This guards externalizing a SLP node when it fails to code generate
    to actually have scalar defs we can use.  It also makes failure
    to do so not fell the whole SLP instance but instead try this again
    on the parent.
    
    2020-07-02  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/96028
            * tree-vect-slp.c (vect_slp_convert_to_external): Make sure
            we have scalar stmts to use.
            (vect_slp_analyze_node_operations): When analyzing a child
            failed try externalizing the parent node.
Comment 7 Richard Biener 2020-07-02 12:39:47 UTC
Fixed.