From: Tobias Burnus Date: Sun, 17 Dec 2006 18:00:46 +0000 (+0100) Subject: associated.c: Check for associated(NULL,NULL). X-Git-Tag: releases/gcc-4.3.0~7933 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ef73bb4ef051fdcf5e186465fa9bf4f7933f8f3;p=thirdparty%2Fgcc.git associated.c: Check for associated(NULL,NULL). 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). From-SVN: r119989 --- 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))