diff options
author | Harald Anlauf <anlauf@gmx.de> | 2022-11-17 21:36:49 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2022-11-18 19:15:09 +0100 |
commit | 820c25c83561085f54268bd536f9d216d03c3e18 (patch) | |
tree | ff5fd604a9720ae2e6758982963b7795d2d43b6b /gcc/fortran/interface.cc | |
parent | add8984069648390a0c5d93719147bcf7d275da2 (diff) | |
download | gcc-820c25c83561085f54268bd536f9d216d03c3e18.zip gcc-820c25c83561085f54268bd536f9d216d03c3e18.tar.gz gcc-820c25c83561085f54268bd536f9d216d03c3e18.tar.bz2 |
Fortran: reject NULL actual argument without explicit interface [PR107576]
gcc/fortran/ChangeLog:
PR fortran/107576
* interface.cc (gfc_procedure_use): Reject NULL as actual argument
when there is no explicit procedure interface.
gcc/testsuite/ChangeLog:
PR fortran/107576
* gfortran.dg/null_actual_3.f90: New test.
Diffstat (limited to 'gcc/fortran/interface.cc')
-rw-r--r-- | gcc/fortran/interface.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index 616ae2b..73799c1 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -4162,6 +4162,14 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) return false; } + if (a->expr && a->expr->expr_type == EXPR_NULL) + { + gfc_error ("Passing intrinsic NULL as actual argument at %L " + "requires an explicit interface", &a->expr->where); + a->expr->error = 1; + return false; + } + /* TS 29113, C407b. */ if (a->expr && a->expr->expr_type == EXPR_VARIABLE && symbol_rank (a->expr->symtree->n.sym) == -1) |