Started with r12 before 20210502 : $ cat z1.c typedef short __attribute__ ((__vector_size__ (64))) V; V v, w; inline V foo (V a, V b); V foo (V a, V b) { vfork(); b &= v < b; return (V){foo (b, w)[3], (V){}[3]}; } $ gcc-13-20230402 -c z1.c z1.c: In function 'foo': z1.c:6:1: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi] 6 | { | ^ z1.c:7:3: warning: implicit declaration of function 'vfork' [-Wimplicit-function-declaration] 7 | vfork(); | ^~~~~ z1.c:5:1: note: the ABI for passing parameters with 64-byte alignment has changed in GCC 4.6 5 | foo (V a, V b) | ^~~ during GIMPLE pass: veclower z1.c:5:1: internal compiler error: in tree_vec_extract, at tree-vect-generic.cc:177 0x111bdd6 tree_vec_extract(gimple_stmt_iterator*, tree_node*, tree_node*, tree_node*, tree_node*) ../../gcc/tree-vect-generic.cc:177 0x111f8fb expand_vector_condition ../../gcc/tree-vect-generic.cc:1140 0x6cac8d expand_vector_comparison ../../gcc/tree-vect-generic.cc:453 0x11229c1 expand_vector_operation ../../gcc/tree-vect-generic.cc:1239 0x11229c1 expand_vector_operations_1 ../../gcc/tree-vect-generic.cc:2357 0x11229c1 expand_vector_operations ../../gcc/tree-vect-generic.cc:2391 0x11229c1 execute ../../gcc/tree-vect-generic.cc:2445
Confirmed. Most likely caused by r12-117-gb972e036f40c . I think the assert happens because the argument t is abnormal SSA_NAME and resimplify/maybe_push_res_to_seq decides it can't do anything on it so returns null.
here is a better testcase which does not use vfork which is implicit returns_twice: ``` typedef short __attribute__ ((__vector_size__ (64))) V; V v, w; void g(void) __attribute__((returns_twice)); V foo (V a, V b) { g(); b &= v < b; return (V){foo (b, w)[3], (V){}[3]}; } ```
(In reply to Andrew Pinski from comment #1) > Confirmed. > > Most likely caused by r12-117-gb972e036f40c . Yes, started with this revision.
Created attachment 54807 [details] gcc13-pr109392.patch Untested fix.
The master branch has been updated by Jeff Law <law@gcc.gnu.org>: https://gcc.gnu.org/g:101380a8394c22a7a2ea70de2060ee93716156e2 commit r13-7126-g101380a8394c22a7a2ea70de2060ee93716156e2 Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Apr 8 12:21:42 2023 -0600 PR tree-optimization/109392 If we have an object with SSA_NAME_OCCURS_IN_ABNORMAL_PHI, then maybe_push_res_to_seq may fail. Directly build the extraction for that case. PR tree-optimization/109392 gcc/ * tree-vect-generic.cc (tree_vec_extract): Handle failure of maybe_push_res_to_seq better. gcc/testsuite/ * gcc.dg/pr109392.c: New test.
The releases/gcc-12 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:d639236ea87ff8a6a2d56c0408e6eb92674418e6 commit r12-9482-gd639236ea87ff8a6a2d56c0408e6eb92674418e6 Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Apr 8 12:21:42 2023 -0600 PR tree-optimization/109392 If we have an object with SSA_NAME_OCCURS_IN_ABNORMAL_PHI, then maybe_push_res_to_seq may fail. Directly build the extraction for that case. PR tree-optimization/109392 gcc/ * tree-vect-generic.cc (tree_vec_extract): Handle failure of maybe_push_res_to_seq better. gcc/testsuite/ * gcc.dg/pr109392.c: New test. (cherry picked from commit 101380a8394c22a7a2ea70de2060ee93716156e2)
Fixed.