This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR30273


Dear All,

I intend to commit this as obvious, later tonight, unless I receive any objections.
It is so obvious and the solution so stable that I see no point in a testcase but
will happily add the reporter's should that be deemed necessary.


I relented and added dependency_19.f90 :-)

Fixed on trunk and 4.2.

Paul



2006-12-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30273
	* dependency.c (gfc_check_dependency): There is no dependency
	with EXPR_NULL so always return 0.

2006-12-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30273
	* gfortran.dg/dependency_19.f90: New test.
Index: gcc/fortran/dependency.c
===================================================================
*** gcc/fortran/dependency.c	(revision 120116)
--- gcc/fortran/dependency.c	(working copy)
*************** gfc_check_dependency (gfc_expr * expr1, 
*** 694,699 ****
--- 694,700 ----
        return 0;
  
      case EXPR_CONSTANT:
+     case EXPR_NULL:
        return 0;
  
      case EXPR_ARRAY:
Index: gcc/testsuite/gfortran.dg/dependency_19.f90
===================================================================
*** gcc/testsuite/gfortran.dg/dependency_19.f90	(revision 0)
--- gcc/testsuite/gfortran.dg/dependency_19.f90	(revision 0)
***************
*** 0 ****
--- 1,34 ----
+ ! { dg-do compile }
+ ! Tests the fix for PR30273, in which the pointer assignment was
+ ! wrongly determined to have dependence because NULL() was not
+ ! recognised by the analysis.
+ !
+ ! Contributed by Harald Anlauf <anlauf@gmx.de>
+ !
+ module gfcbug49
+   implicit none
+ 
+   type spot_t
+      integer, pointer     :: vm(:,:,:)
+   end type spot_t
+ 
+   type rc_t
+     integer               :: n
+     type(spot_t), pointer :: spots(:) => NULL()
+   end type rc_t  
+ 
+ contains
+ 
+   subroutine construct (rc, n)
+     type(rc_t), intent(out) :: rc
+     integer   , intent(in)  :: n
+     integer :: k
+     rc% n = n
+     allocate (rc% spots (n))
+     forall (k=1:n)
+        rc% spots (k)% vm => NULL() ! gfortran didn't swallow this
+     end forall
+   end subroutine construct
+ 
+ end module gfcbug49
+ ! { dg-final { cleanup-modules "gfcbug49" } }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]