$ cat bug.c float a, d, e, f, g; int b, c; void h() { for (; b; b++) { for (; c;) { float i = d = i; } a += f - e * g; a += g + e * f; } } $ gcc -c -O3 -march=armv8-a+sve bug.c during GIMPLE pass: vect <source>: In function 'h': <source>:3:6: internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.cc:250 3 | void h() { | ^ 0x1168eb4 compute_live_loop_exits /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:250 0x1168eb4 add_exit_phis_var /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:332 0x1168eb4 add_exit_phis /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:393 0x1168eb4 rewrite_into_loop_closed_ssa_1 /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:606 0x1168eb4 rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int) /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-ssa-loop-manip.cc:628 0x130a1e8 execute /data/jenkins/workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/tree-vectorizer.cc:1358 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. Compiler returned: 1
see also bug 111479
Confirmed. We have a two-operator operation in the preheader instead of in the loop body. IIRC we have a duplicate for this, this is all invariant operations and we get confused applying loop masking to it somehow.
Marking as P1. We hit this with a Fortran reproducer: SUBROUTINE REPRODUCER( M, A, LDA ) IMPLICIT NONE INTEGER LDA, M, I COMPLEX A( LDA, * ) DO I = 2, M A( I, 1 ) = A( I, 1 ) / A( 1, 1 ) END DO RETURN END on aarch64 with -march=armv8-a+sve -O3 The ICE triggeres on 12.3 but compiles fine wiht 12.2
I can't reproduce either of the testcases here any more .
(In reply to Andrew Pinski from comment #4) > I can't reproduce either of the testcases here any more . I should say on the trunk.
Fixed by r14-5320-ge5f1956498251a4973d52c8aad3faf34d0443169, I'll take that for backporting.
Backported to GCC 13.
Hi Richard, Are you also planning to backport it to gcc-12? Regards, Saurabh
(In reply to Saurabh Jha from comment #8) > Hi Richard, > > Are you also planning to backport it to gcc-12? Yes.
This has now been backported to gcc-13 and gcc-12, so I think we should close, will leave that to Richard.
Fixed.