diff options
author | Harald Anlauf <anlauf@gmx.de> | 2022-11-17 21:36:49 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2022-11-25 23:27:36 +0100 |
commit | b3b48f883d31910f2672640de2f5ff59e765488c (patch) | |
tree | f91fc4a9ddf4b08f9436179c9fea4901d13e3a30 /gcc/fortran | |
parent | ac5044574cc4edbd43aacb09461bbaa0cedc684b (diff) | |
download | gcc-b3b48f883d31910f2672640de2f5ff59e765488c.zip gcc-b3b48f883d31910f2672640de2f5ff59e765488c.tar.gz gcc-b3b48f883d31910f2672640de2f5ff59e765488c.tar.bz2 |
Fortran: reject NULL actual argument without explicit interface [PR107576]
gcc/fortran/ChangeLog:
PR fortran/107576
* interface.c (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.
(cherry picked from commit 820c25c83561085f54268bd536f9d216d03c3e18)
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/interface.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index a8a88f1..19ba7fd 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -3968,6 +3968,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) |