aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2022-11-17 21:36:49 +0100
committerHarald Anlauf <anlauf@gmx.de>2022-11-25 23:27:36 +0100
commitb3b48f883d31910f2672640de2f5ff59e765488c (patch)
treef91fc4a9ddf4b08f9436179c9fea4901d13e3a30 /gcc/fortran
parentac5044574cc4edbd43aacb09461bbaa0cedc684b (diff)
downloadgcc-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.c8
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)