diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2024-04-21 17:24:24 +0100 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2024-04-21 17:24:24 +0100 |
commit | f17d31e709af9b2d488adecd6cd040dfc1f23b04 (patch) | |
tree | 3a23c1c37998e9991a0550be826a3178042f5608 /gcc/testsuite/gfortran.dg | |
parent | a44d16efa7a508f8b8f303417d0714c39f159725 (diff) | |
download | gcc-f17d31e709af9b2d488adecd6cd040dfc1f23b04.zip gcc-f17d31e709af9b2d488adecd6cd040dfc1f23b04.tar.gz gcc-f17d31e709af9b2d488adecd6cd040dfc1f23b04.tar.bz2 |
Fortran: Detect 'no implicit type' error in right place [PR103471]
2024-04-21 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/103471
* resolve.cc (resolve_actual_arglist): Catch variables silently
set as untyped, resetting the flag so that gfc_resolve_expr can
generate the no implicit type error.
(gfc_resolve_index_1): Block index expressions of unknown type
from being converted to default integer, avoiding the fatal
error in trans-decl.cc.
* symbol.cc (gfc_set_default_type): Remove '(symbol)' from the
'no IMPLICIT type' error message.
* trans-decl.cc (gfc_get_symbol_decl): Change fatal error locus
to that of the symbol declaration.
(gfc_trans_deferred_vars): Remove two trailing tabs.
gcc/testsuite/
PR fortran/103471
* gfortran.dg/pr103471.f90: New test.
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr103471.f90 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr103471.f90 b/gcc/testsuite/gfortran.dg/pr103471.f90 new file mode 100644 index 0000000..695446e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103471.f90 @@ -0,0 +1,18 @@ +! { 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 |