]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal argument)
authorPaul Thomas <pault@gcc.gnu.org>
Tue, 16 Aug 2011 21:22:31 +0000 (21:22 +0000)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 16 Aug 2011 21:22:31 +0000 (23:22 +0200)
2011-08-16  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/42051
PR fortran/43896
PR fortran/49962
* trans-expr.c (gfc_conv_derived_to_class): Handle array-valued
functions with CLASS formal arguments.

2011-08-16  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/42051
PR fortran/43896
PR fortran/49962
* gfortran.dg/class_23.f03: New test.

From-SVN: r177800

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_23.f03 [new file with mode: 0644]

index 28d574a46765e3c183d556f465b8d32f675b4d45..ba107157cce1f65c35279b1819c98f1af63a31fe 100644 (file)
@@ -1,3 +1,11 @@
+2011-08-16  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/42051
+       PR fortran/43896
+       PR fortran/49962
+       * trans-expr.c (gfc_conv_derived_to_class): Handle array-valued
+       functions with CLASS formal arguments.
+
 2011-07-23  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/49708
index aa91aa3c15a13ad50c621cf2506757e26eeffc34..b3d49cc50d0b7586211a2e58bba90ad1cefe0779 100644 (file)
@@ -2638,12 +2638,14 @@ gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e,
   ss = gfc_walk_expr (e);
   if (ss == gfc_ss_terminator)
     {
+      parmse->ss = NULL;
       gfc_conv_expr_reference (parmse, e);
       tmp = fold_convert (TREE_TYPE (ctree), parmse->expr);
       gfc_add_modify (&parmse->pre, ctree, tmp);
     }
   else
     {
+      parmse->ss = ss;
       gfc_conv_expr (parmse, e);
       gfc_add_modify (&parmse->pre, ctree, parmse->expr);
     }
index 667d4a73891e7aaa3c389bce11b35eacd9780b67..040c6b8c2604997e268274b6fbb4b55dcc989cc8 100644 (file)
@@ -1,3 +1,10 @@
+2011-08-16  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/42051
+       PR fortran/43896
+       PR fortran/49962
+       * gfortran.dg/class_23.f03: New test.
+
 2011-07-31  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/49920
diff --git a/gcc/testsuite/gfortran.dg/class_23.f03 b/gcc/testsuite/gfortran.dg/class_23.f03
new file mode 100644 (file)
index 0000000..e1e3517
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR 42051: [OOP] ICE on array-valued function with CLASS formal argument
+!
+! Original test case by Damian Rouson <damian@rouson.net>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+  type grid
+  end type 
+
+contains
+
+  function return_x(this) result(this_x)
+    class(grid) :: this
+    real  ,dimension(1) :: this_x
+  end function
+
+  subroutine output()
+    type(grid) :: mesh
+    real ,dimension(1) :: x
+    x = return_x(mesh)
+  end subroutine
+
+end