re PR fortran/45745 (ICE in gfc_conv_array_stride)
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 23 Sep 2010 11:11:23 +0000 (11:11 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 23 Sep 2010 11:11:23 +0000 (11:11 +0000)
2010-09-23  Mikael Morin  <mikael@gcc.gnu.org>

PR fortran/45745
PR fortran/45648
* trans-array.c (gfc_conv_expr_descriptor): Handle
ss->type == GFC_SS_INTRINSIC (for {l,u}bound intrinsics) case.

2010-09-23  Mikael Morin  <mikael@gcc.gnu.org>

PR fortran/45745
PR fortran/45648
* gfortran.dg/vector_subscript_bound_1.f90: New.

From-SVN: r164558

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vector_subscript_bound_1.f90 [new file with mode: 0644]

index d99720ea6eb6487db7c1112e1a7e5fa0968c9b6a..d57a4499b71158cd273a045ce596a895bae7f923 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-23  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/45745
+       PR fortran/45648
+       * trans-array.c (gfc_conv_expr_descriptor): Handle 
+       ss->type == GFC_SS_INTRINSIC (for {l,u}bound intrinsics) case. 
+
 2010-09-23  Tobias Burnus  <burnus@net-b.de>
 
        * intrinsic.texi (OpenMP modules): Add named constants of
index 310a42b00f3475a1ce039ce63746d8c69fcfbaa9..b32c3eccd8f1be4c4a45760487888a69fef3c79b 100644 (file)
@@ -5290,13 +5290,17 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
          return;
        }
 
-      if (ss->expr != expr)
+      if (ss->expr != expr || ss->type != GFC_SS_FUNCTION)
        {
-         /* Elemental function.  */
-         gcc_assert ((expr->value.function.esym != NULL
-                      && expr->value.function.esym->attr.elemental)
-                     || (expr->value.function.isym != NULL
-                         && expr->value.function.isym->elemental));
+         if (ss->expr != expr)
+           /* Elemental function.  */
+           gcc_assert ((expr->value.function.esym != NULL
+                        && expr->value.function.esym->attr.elemental)
+                       || (expr->value.function.isym != NULL
+                           && expr->value.function.isym->elemental));
+         else
+           gcc_assert (ss->type == GFC_SS_INTRINSIC);
+
          need_tmp = 1;
          if (expr->ts.type == BT_CHARACTER
                && expr->ts.u.cl->length->expr_type != EXPR_CONSTANT)
index 050e571e5ce9394742c1abe3c0746e02c9e3e23d..da30c4be44530224a62eac00f90b3c9f56e2bc74 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-23  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/45745
+       PR fortran/45648
+       * gfortran.dg/vector_subscript_bound_1.f90: New.
+
 2010-09-23  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/45750
diff --git a/gcc/testsuite/gfortran.dg/vector_subscript_bound_1.f90 b/gcc/testsuite/gfortran.dg/vector_subscript_bound_1.f90
new file mode 100644 (file)
index 0000000..f432850
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/45745
+! ICE with {L,U}BOUND intrinsic function as vector subscript on derived
+! type component. 
+!
+! Original test by Joost Van de Vondele <Joost.VandeVondele@pci.uzh.ch>
+
+MODULE pw_types
+  TYPE pw_type
+     REAL, DIMENSION ( : ), POINTER :: cr
+  END TYPE pw_type
+CONTAINS
+  SUBROUTINE pw_write(pw)
+    TYPE(pw_type), INTENT(in) :: pw
+    PRINT *, pw%cr(LBOUND(pw%cr))
+    PRINT *, pw%cr(UBOUND(pw%cr))
+  END SUBROUTINE pw_write
+END MODULE