gfc_current_ns = gfc_get_namespace (NULL, 0);
e = gfc_copy_expr (len);
+ gfc_push_suppress_errors ();
gfc_reduce_init_expr (e);
+ gfc_pop_suppress_errors ();
if (e->expr_type == EXPR_CONSTANT)
{
gfc_replace_expr (len, e);
}
+/* Query whether errors are suppressed. */
+
+bool
+gfc_query_suppress_errors (void)
+{
+ return suppress_errors > 0;
+}
+
+
/* Determine terminal width (for trimming source lines in output). */
static int
void gfc_push_suppress_errors (void);
void gfc_pop_suppress_errors (void);
+bool gfc_query_suppress_errors (void);
/* Character length structures hold the expression that gives the
if (ts->type == BT_UNKNOWN)
{
- if (error_flag && !sym->attr.untyped)
+ if (error_flag && !sym->attr.untyped && !gfc_query_suppress_errors ())
{
const char *guessed = lookup_symbol_fuzzy (sym->name, sym);
if (guessed)
--- /dev/null
+! { dg-do compile}
+! { dg-additional-options "-Wno-pedantic" }
+!
+! Test from PR103258. This used to ICE due to incorrectly marking the
+! no-implicit-type error for n and m in the character length expression
+! as already diagnosed during early resolution, when in fact errors are
+! ignored in that parsing context. We now expect the errors to be diagnosed
+! at the point of the first use of each symbol.
+
+subroutine s(n) ! { dg-error "Symbol 'n' .*has no IMPLICIT type" }
+implicit none
+character(n+m) :: c ! { dg-error "Symbol 'm' .*has no IMPLICIT type" }
+entry e(m)
+end