From: burnus Date: Sun, 17 Dec 2006 18:00:46 +0000 (+0000) Subject: 2006-12-17 Tobias Burnus X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8be94ca91d060ade8a27d480b533b59bda69f43d;p=thirdparty%2Fgcc.git 2006-12-17 Tobias Burnus * intrinsics/associated.c: Check for associated(NULL,NULL). 2006-12-17 Tobias Burnus * gfortran.dg/associated_2.f90: Add test for associated(NULL,NULL). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119989 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6d8074e2fc8a..39abc504ee74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-12-17 Tobias Burnus + + * gfortran.dg/associated_2.f90: Add test for associated(NULL,NULL). + 2006-12-16 Manuel Lopez-Ibanez PR middle-end/7651 diff --git a/gcc/testsuite/gfortran.dg/associated_2.f90 b/gcc/testsuite/gfortran.dg/associated_2.f90 index 5b8b689d1f4b..1ff8006de009 100644 --- a/gcc/testsuite/gfortran.dg/associated_2.f90 +++ b/gcc/testsuite/gfortran.dg/associated_2.f90 @@ -17,6 +17,8 @@ contains ! the target argument is not present (case (i)) if (.not. associated (b)) call abort () deallocate (a) + nullify(a) + if(associated(a,a)) call abort() allocate (a(2,1,2)) b => a if (.not.associated (b)) call abort () diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 0844d1a6df7c..ff7adbe2da65 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,7 @@ +2006-12-17 Tobias Burnus + + * intrinsics/associated.c: Check for associated(NULL,NULL). + 2006-12-15 Jerry DeLisle PR libfortran/30145 diff --git a/libgfortran/intrinsics/associated.c b/libgfortran/intrinsics/associated.c index 1a05f20072bc..d5ef556b80cf 100644 --- a/libgfortran/intrinsics/associated.c +++ b/libgfortran/intrinsics/associated.c @@ -39,6 +39,8 @@ associated (const gfc_array_void *pointer, const gfc_array_void *target) { int n, rank; + if (GFC_DESCRIPTOR_DATA (pointer) == NULL) + return 0; if (GFC_DESCRIPTOR_DATA (pointer) != GFC_DESCRIPTOR_DATA (target)) return 0; if (GFC_DESCRIPTOR_DTYPE (pointer) != GFC_DESCRIPTOR_DTYPE (target))