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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, Apr 03, 2023 at 08:16:20PM +0000, anlauf at gcc dot gnu.org wrote:
> --- Comment #3 from anlauf at gcc dot gnu.org ---
> (In reply to kargl from comment #2)
> > 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.  */
> 
> This is a gem: not dead code, but un-dead code ... ;-)
> 

What I haven't concluded yet is if the code was copied
with the intention to edit for another error condition,
e.g., "case_value == -2" or check on code->expr2.

Reply via email to