OSDN Git Service

2012-05-02 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 May 2012 12:51:49 +0000 (12:51 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 May 2012 12:51:49 +0000 (12:51 +0000)
        Backport from mainline
        2012-04-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52864
        * expr.c (gfc_check_vardef_context): Fix assignment check for
        pointer components.

2012-05-02  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-04-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52864
        * gfortran.dg/pointer_intent_6.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@187044 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pointer_intent_6.f90 [new file with mode: 0644]

index eb07bae..c4be6f2 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-02  Tobias Burnus  <burnus@net-b.de>
+
+       Backport from mainline
+       2012-04-12  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52864
+       * expr.c (gfc_check_vardef_context): Fix assignment check for
+       pointer components.
+
 2012-04-30  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/53148
index 129ece3..18e26e3 100644 (file)
@@ -4654,7 +4654,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
       if (ptr_component && ref->type == REF_COMPONENT)
        check_intentin = false;
       if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer)
-       ptr_component = true;
+       {
+         ptr_component = true;
+         if (!pointer)
+           check_intentin = false;
+       }
     }
   if (check_intentin && sym->attr.intent == INTENT_IN)
     {
index 3c4c138..3653154 100644 (file)
@@ -1,3 +1,11 @@
+2012-05-02  Tobias Burnus  <burnus@net-b.de>
+
+       Backport from mainline
+       2012-04-16  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/52864
+       * gfortran.dg/pointer_intent_6.f90: New.
+
 2012-05-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/53163
diff --git a/gcc/testsuite/gfortran.dg/pointer_intent_6.f90 b/gcc/testsuite/gfortran.dg/pointer_intent_6.f90
new file mode 100644 (file)
index 0000000..56c7de5
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/52864
+!
+! Assigning to an intent(in) pointer (which is valid).
+!
+      program test
+         type PoisFFT_Solver3D
+           complex, dimension(:,:,:), &
+                           pointer :: work => null()
+         end type PoisFFT_Solver3D
+      contains
+        subroutine PoisFFT_Solver3D_FullPeriodic(D, p)
+          type(PoisFFT_Solver3D), intent(in) :: D
+          real, intent(in), pointer :: p(:)
+          D%work(i,j,k) = 0.0
+          p = 0.0
+        end subroutine
+      end