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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #7 from anlauf at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #6)
> The current mainline and 13-branches now power through to the fatal error at
> trans-decl.cc:1800.

True, but the location does not look nice:

pr103471.f90:1:9:

    1 | program p
      |         1
Fatal Error: k at (1) has no default type
compilation terminated.


With the following tentative - but otherwise untested - change:

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index e160c5c98c1..602f35f0cab 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -1797,7 +1797,9 @@ gfc_get_symbol_decl (gfc_symbol * sym)
     }

   if (sym->ts.type == BT_UNKNOWN)
-    gfc_fatal_error ("%s at %C has no default type", sym->name);
+//    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");


we are back at:

pr103471.f90:3:21:

    3 |    print *, [real(x(k))]
      |                     1
Fatal Error: k at (1) has no default type
compilation terminated.


This looks more user friendly.

Reply via email to