? CLASS_DATA (sym)->as : sym->as;
}
+ /* These symbols are set untyped by calls to gfc_set_default_type
+ with 'error_flag' = false. Reset the untyped attribute so that
+ the error will be generated in gfc_resolve_expr. */
+ if (e->expr_type == EXPR_VARIABLE
+ && sym->ts.type == BT_UNKNOWN
+ && sym->attr.untyped)
+ sym->attr.untyped = 0;
+
/* Expressions are assigned a default ts.type of BT_PROCEDURE in
primary.cc (match_actual_arg). If above code determines that it
is a variable instead, it needs to be resolved as it was not
if ((index->ts.kind != gfc_index_integer_kind
&& force_index_integer_kind)
- || index->ts.type != BT_INTEGER)
+ || (index->ts.type != BT_INTEGER
+ && index->ts.type != BT_UNKNOWN))
{
gfc_clear_ts (&ts);
ts.type = BT_INTEGER;
"; did you mean %qs?",
sym->name, &sym->declared_at, guessed);
else
- gfc_error ("Symbol %qs at %L has no IMPLICIT type(symbol)",
+ gfc_error ("Symbol %qs at %L has no IMPLICIT type",
sym->name, &sym->declared_at);
sym->attr.untyped = 1; /* Ensure we only give an error once. */
}
}
if (sym->ts.type == BT_UNKNOWN)
- gfc_fatal_error ("%s at %C has no default type", sym->name);
+ gfc_fatal_error ("%s at %L has no default type", sym->name,
+ &sym->declared_at);
if (sym->attr.intrinsic)
gfc_internal_error ("intrinsic variable which isn't a procedure");
tree tmp = lookup_attribute ("omp allocate",
DECL_ATTRIBUTES (n->sym->backend_decl));
tmp = TREE_VALUE (tmp);
- TREE_PURPOSE (tmp) = se.expr;
- TREE_VALUE (tmp) = align;
+ TREE_PURPOSE (tmp) = se.expr;
+ TREE_VALUE (tmp) = align;
TREE_PURPOSE (TREE_CHAIN (tmp)) = init_stmtlist;
TREE_VALUE (TREE_CHAIN (tmp)) = cleanup_stmtlist;
}
--- /dev/null
+! { dg-do compile }
+! Test the fix for PR103471 in which, rather than giving a "no IMPLICIT type"
+! message, gfortran took to ICEing. The fuzzy symbol check for 'kk' demonstrates
+! that the error is being detected at the right place.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ implicit none
+ integer, parameter :: x(4) = [1,2,3,4]
+ real, external :: y
+ integer :: kk
+ print *, [real(y(l))] ! { dg-error "has no IMPLICIT type" }
+ print *, [real(x(k))] ! { dg-error "has no IMPLICIT type; did you mean .kk.\\?" }
+! This silently suppresses the error in the previous line. With the line before
+! commented out, the error occurs in trans-decl.cc.
+! print *, [real(y(k))]
+end