https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100607
Bug ID: 100607 Summary: ICE with SELECT RANK Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- Created attachment 50815 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50815&action=edit Fortran testcase The following program works, if the invalid code is commented. The invalid part violates (quote from F202x but same in F2018): "C1158 A SELECT RANK construct shall not have aselect-rank-case-stmtthat is RANK ( * ) if the selector23has the ALLOCATABLE or POINTER attribute." Hence, the code is invalid. Output is the following Notes: - '__tmp_INTEGER_4_rank_m1' error is bogus - 'cannot be used' error is valid, but should only be printed once - An ICE is always wrong, of course. 24 | rank(*) ! { dg-error "cannot be used with the pointer or allocatable selector" } Error: Allocatable array ‘__tmp_INTEGER_4_rank_m1’ at (1) must have a deferred shape or assumed rank 24 | rank(*) ! { dg-error "cannot be used with the pointer or allocatable selector" } Error: RANK (*) at (1) cannot be used with the pointer or allocatable selector at (2) 24 | rank(*) ! { dg-error "cannot be used with the pointer or allocatable selector" } Error: RANK (*) at (1) cannot be used with the pointer or allocatable selector at (2) f951: internal compiler error: in simplify_bound, at fortran/simplify.c:4266 0x619680 simplify_bound ../../repos/gcc/gcc/fortran/simplify.c:4266