Patchwork [Fortran] PR57141 - fix using use-associated NULL() intrinsic

login
register
mail settings
Submitter Tobias Burnus
Date May 3, 2013, 10:30 a.m.
Message ID <518391D0.4030706@net-b.de>
Download mbox | patch
Permalink /patch/241262/
State New
Headers show

Comments

Tobias Burnus - May 3, 2013, 10:30 a.m.
The problem is that the procedure attributed is tried to be set to 
NULL() - but that's rejected because null() is use associated. I am not 
sure whether this is the cleanest patch, but I think it should be fine.

Build and regtested on x86-64-gnu-linux.
OK for the turnk?

PENDING PATCHES:
- http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01817.html
- http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01787.html

Tobias

Patch

2013-05-03  Tobias Burnus  <burnus@net-b.de>

	PR fortran/57141
	* decl.c (gfc_match_null): Permit use-associated
	NULL intrinsic.

2013-05-03  Tobias Burnus  <burnus@net-b.de>

	PR fortran/57141
	* gfortran.dg/null_8.f90: New.

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index f9891c9..561fbf9 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1703,6 +1703,7 @@  gfc_match_null (gfc_expr **result)
   gfc_intrinsic_symbol (sym);
 
   if (sym->attr.proc != PROC_INTRINSIC
+      && !(sym->attr.use_assoc && sym->attr.intrinsic)
       && (!gfc_add_procedure(&sym->attr, PROC_INTRINSIC, sym->name, NULL)
 	  || !gfc_add_function (&sym->attr, sym->name, NULL)))
     return MATCH_ERROR;
--- /dev/null	2013-05-03 08:51:02.564101575 +0200
+++ gcc/gcc/testsuite/gfortran.dg/null_8.f90	2013-05-03 11:02:38.556020968 +0200
@@ -0,0 +1,15 @@ 
+! { dg-do compile }
+!
+! PR fortran/57141
+!
+! Contributed by Roger Ferrer Ibanez 
+!
+MODULE M
+    INTRINSIC :: NULL
+END MODULE M
+
+MODULE M_INTERN
+    USE M
+    IMPLICIT NONE
+    REAL, POINTER :: ARR(:) => NULL()
+END MODULE M_INTERN