https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100607
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-invalid-code | Priority|P3 |P4 --- Comment #2 from kargl at gcc dot gnu.org --- Remove ice-on-invalid-code as I don't get an ICE. The following patch suppresses the error message with the temporary variable and removes duplicated code. Please commit. diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 46585879ddc..3462d43f346 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -9909,11 +9909,6 @@ resolve_select_rank (gfc_code *code, gfc_namespace *old_ns) || gfc_expr_attr (code->expr1).pointer)) gfc_error ("RANK (*) at %L cannot be used with the pointer or " "allocatable selector at %L", &c->where, &code->expr1->where); - - if (case_value == -1 && (gfc_expr_attr (code->expr1).allocatable - || gfc_expr_attr (code->expr1).pointer)) - gfc_error ("RANK (*) at %L cannot be used with the pointer or " - "allocatable selector at %L", &c->where, &code->expr1->where); } /* Add EXEC_SELECT to switch on rank. */ @@ -12948,7 +12943,9 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag) if (allocatable) { - if (dimension && as->type != AS_ASSUMED_RANK) + if (dimension + && as->type != AS_ASSUMED_RANK + && !sym->attr.select_rank_temporary) { gfc_error ("Allocatable array %qs at %L must have a deferred " "shape or assumed rank", sym->name, &sym->declared_at);