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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2022-11-15
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from kargl at gcc dot gnu.org ---
Another example of why -fmax-errors=1 should be the default.

A run-on warning triggers tried to get a gmp value from a BT_REAL entity.

Fixed by

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index d3e199535b3..ce68d863fdf 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -3271,10 +3271,14 @@ gfc_compare_actual_formal (gfc_actual_arglist **ap,
gfc_formal_arglist *formal,
         and assumed-shape dummies, the string length needs to match
         exactly.  */
       if (a->expr->ts.type == BT_CHARACTER
-         && a->expr->ts.u.cl && a->expr->ts.u.cl->length
+         && a->expr->ts.u.cl
+         && a->expr->ts.u.cl->length
+         && a->expr->ts.u.cl->length->ts.type == BT_INTEGER
          && a->expr->ts.u.cl->length->expr_type == EXPR_CONSTANT
-         && f->sym->ts.type == BT_CHARACTER && f->sym->ts.u.cl
+         && f->sym->ts.type == BT_CHARACTER
+         && f->sym->ts.u.cl
          && f->sym->ts.u.cl->length
+         && f->sym->ts.u.cl->length->ts.type == BT_INTEGER
          && f->sym->ts.u.cl->length->expr_type == EXPR_CONSTANT
          && (f->sym->attr.pointer || f->sym->attr.allocatable
              || (f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))

Reply via email to