Bug 113494 - [14 Regression] ICE (segfault) in slpeel_tree_duplicate_loop_to_edge_cfg since r14-8206-g0f38666680d6ad0e
Summary: [14 Regression] ICE (segfault) in slpeel_tree_duplicate_loop_to_edge_cfg sinc...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: 14.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2024-01-18 22:27 UTC by Alex Coplan
Modified: 2024-01-19 09:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-01-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Coplan 2024-01-18 22:27:34 UTC
The following fails on aarch64:

./xgcc -B . -c ~/toolchain/src/gcc/gcc/testsuite/gcc.c-torture/execute/20150611-1.c -S -o /dev/null -O3
during GIMPLE pass: vect
/home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.c-torture/execute/20150611-1.c: In function ‘main’:
/home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.c-torture/execute/20150611-1.c:5:1: internal compiler error: Segmentation fault
    5 | main ()
      | ^~~~
0x30bdd30 crash_signal
        /home/alecop01/toolchain/src/gcc/gcc/toplev.cc:317
0x7f38d1b6708f ???
        /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x26e6cf6 gimple_phi_result(gphi const*)
        /home/alecop01/toolchain/src/gcc/gcc/gimple.h:4608
0x34b7f10 slpeel_tree_duplicate_loop_to_edge_cfg(loop*, edge_def*, loop*, edge_def*, edge_def*, edge_def**, bool, vec<basic_block_def*, va_heap, vl_ptr>*)
        /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop-manip.cc:1751
0x34bceea vect_do_peeling(_loop_vec_info*, tree_node*, tree_node*, tree_node**, tree_node**, tree_node**, int, bool, bool, tree_node**)
        /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop-manip.cc:3342
0x34a85f3 vect_transform_loop(_loop_vec_info*, gimple*)
        /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.cc:11929
0x34fdcda vect_transform_loops
        /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.cc:1006
0x34fe445 try_vectorize_loop_1
        /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.cc:1152
0x34fe57e try_vectorize_loop
        /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.cc:1182
0x34fe844 execute
        /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.cc:1298
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Andrew Pinski 2024-01-18 22:39:36 UTC
Looks like it also caused the same ICE with AVX512 enabled:
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/643395.html
Comment 2 Richard Biener 2024-01-19 09:17:20 UTC
I'm testing a patch.
Comment 3 GCC Commits 2024-01-19 09:43:30 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:6ce7008cfa1a240895ecca0898e7dbaecd975567

commit r14-8280-g6ce7008cfa1a240895ecca0898e7dbaecd975567
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 19 09:23:48 2024 +0100

    tree-optimization/113494 - Fix two observed regressions with r14-8206
    
    The following handles the situation where we lack a loop-closed
    PHI for a virtual operand because a loop exit goes to a code
    region not having any virtual use (an endless loop).  It also
    handles the situation of edge redirection re-allocating a PHI node
    in the destination block so we have to re-lookup that before
    populating the new PHI argument.
    
            PR tree-optimization/113494
            * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
            Handle endless loop on exit.  Handle re-allocated PHI.
Comment 4 Richard Biener 2024-01-19 09:48:29 UTC
Fixed.