From 9d45e848d02e71c11420ec49630281e9a29c89b8 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 26 Mar 2021 08:39:24 +0100 Subject: [PATCH] Fortran: Fix intrinsic null() handling [PR99651] gcc/fortran/ChangeLog: PR fortran/99651 * intrinsic.c (gfc_intrinsic_func_interface): Set attr.proc = PROC_INTRINSIC if FL_PROCEDURE. gcc/testsuite/ChangeLog: PR fortran/99651 * gfortran.dg/null_11.f90: New test. --- gcc/fortran/intrinsic.c | 5 +++++ gcc/testsuite/gfortran.dg/null_11.f90 | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/null_11.f90 diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index e68eff8bdbb..17fd92eb462 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -5071,6 +5071,11 @@ got_specific: sym->attr.intrinsic = 1; sym->attr.flavor = FL_PROCEDURE; } + if (sym->attr.flavor == FL_PROCEDURE) + { + sym->attr.function = 1; + sym->attr.proc = PROC_INTRINSIC; + } if (!sym->module) gfc_intrinsic_symbol (sym); diff --git a/gcc/testsuite/gfortran.dg/null_11.f90 b/gcc/testsuite/gfortran.dg/null_11.f90 new file mode 100644 index 00000000000..040cc260b5d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/null_11.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR fortran/99651 +! +module m + type :: CHAR_STAR + character(len=1),dimension(:),pointer :: ptr + end type + type(CHAR_STAR), parameter ::CHAR_STAR_NULL = CHAR_STAR(NULL()) +end module m + +use m +type typeNode + type(typeNode), pointer :: Next => null() +end type typeNode +end