https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116956

            Bug ID: 116956
           Summary: ICE when building PALM with gfortran: in
                    vect_analyze_loop_1, at tree-vect-loop.cc:3510
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soumyaa at nvidia dot com
                CC: tamar.christina at arm dot com
  Target Milestone: ---

When building the PALM Model <https://palm.muk.uni-hannover.de/trac>, gfortran
emits an ICE.

The reduced test case to reproduce this bug is:

SUBROUTINE nesting_offl_init(u, v, mask)
       IMPLICIT NONE
       real :: u(:)
       real :: v(:)
       integer :: mask(:)
       u = MERGE( u, v, BTEST (mask, 1) )
END SUBROUTINE nesting_offl_init

and can be checked when running with -O3 -mcpu=neoverse-v2.

ICEing after the following commit:

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0c5c0c959c2e592b84739f19ca771fa69eb8dfee

The assert at tree-vect-loop.cc:3510 seems to be checking if the main loop is
empty when processing the epilogue loop. Removing this assert fixes the ICE. 

Backtrace:
during GIMPLE pass: vect
palm.f90:1:28:

    1 | SUBROUTINE nesting_offl_init(u, v, mask)
      |                            ^
internal compiler error: in vect_analyze_loop_1, at tree-vect-loop.cc:3510
0x22953db internal_error(char const*, ...)
        ../../gcc_src/gcc/diagnostic-global-context.cc:517
0x7e616b fancy_abort(char const*, int, char const*)
        ../../gcc_src/gcc/diagnostic.cc:1572
0x134fd43 vect_analyze_loop_1
        ../../gcc_src/gcc/tree-vect-loop.cc:3510
0x135062b vect_analyze_loop(loop*, vec_info_shared*)
        ../../gcc_src/gcc/tree-vect-loop.cc:3711
0x13997cb try_vectorize_loop_1
        ../../gcc_src/gcc/tree-vectorizer.cc:1070
0x13997cb try_vectorize_loop
        ../../gcc_src/gcc/tree-vectorizer.cc:1186
0x1399d83 execute
        ../../gcc_src/gcc/tree-vectorizer.cc:1302

Reply via email to