re PR fortran/57508 ([OOP] Intrinsic assignment+defined-assignment for comps: PROCEDU...
authorTobias Burnus <burnus@net-b.de>
Fri, 14 Jun 2013 11:24:27 +0000 (13:24 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 14 Jun 2013 11:24:27 +0000 (13:24 +0200)
2013-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57508
        * resolve.c (get_temp_from_expr): Don't copy function
        result attributes to temporary.

2013-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57508
        * gfortran.dg/defined_assignment_7.f90: New.

From-SVN: r200089

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

index 07ab220941945fd7a9a4232340ee7d19195c8bc0..89c2ea4891d5f37bab97b49419f9f9d5b21d2f86 100644 (file)
@@ -1,3 +1,9 @@
+2013-06-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/57508
+       * resolve.c (get_temp_from_expr): Don't copy function
+       result attributes to temporary.
+
 2013-06-14  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/57596
index b2e8fdc1bb95ccdbb4840e99991253b1a446e276..2788994112a0ad8496eeb837581b547d01a0b0c2 100644 (file)
@@ -9295,6 +9295,10 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
 
   /* Add the attributes and the arrayspec to the temporary.  */
   tmp->n.sym->attr = gfc_expr_attr (e);
+  tmp->n.sym->attr.function = 0;
+  tmp->n.sym->attr.result = 0;
+  tmp->n.sym->attr.flavor = FL_VARIABLE;
+
   if (as)
     {
       tmp->n.sym->as = gfc_copy_array_spec (as);
index 119a7648c7d81bd01ce5e53381d8ae4b2703dced..ea929e013d05c9dba302622a79641f29a9d840fb 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/57508
+       * gfortran.dg/defined_assignment_7.f90: New.
+
 2013-06-14  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/57599
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_7.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_7.f90
new file mode 100644 (file)
index 0000000..5f60f50
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-compile }
+!
+! PR fortran/57508
+!
+module ForTrilinos_ref_counter
+  type ref_counter
+  contains
+      procedure :: assign
+      generic   :: assignment(=) => assign
+  end type
+contains
+  subroutine assign (lhs, rhs)
+    class (ref_counter), intent(inout) :: lhs
+    class (ref_counter), intent(in) :: rhs
+  end subroutine
+end module
+module FEpetra_BlockMap
+  use ForTrilinos_ref_counter, only : ref_counter
+  type :: Epetra_BlockMap 
+    type(ref_counter) :: counter
+  end type
+contains
+  function from_struct() result(new_Epetra_BlockMap)
+    type(Epetra_BlockMap) :: new_Epetra_BlockMap
+  end function
+  type(Epetra_BlockMap) function create_arbitrary()
+    create_arbitrary = from_struct()
+  end function
+end module