]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/51448 (Compiler crash when assigning floating point values of different...
authorTobias Burnus <burnus@net-b.de>
Thu, 8 Dec 2011 20:54:57 +0000 (21:54 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 8 Dec 2011 20:54:57 +0000 (21:54 +0100)
2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * fortran/trans-array.c (get_std_lbound): Fix handling of
        conversion functions.

2011-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51448
        * gfortran.dg/realloc_on_assign_8.f90: New.

From-SVN: r182137

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

index 0309cbc12020a151852debcd00f9454b1c0bfecb..943f885cdab15d712e6f20bdb40058ddd890ed90 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-08  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/51448
+       * fortran/trans-array.c (get_std_lbound): Fix handling of
+       conversion functions.
+
 2011-12-06  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51435
index 1eef35996226d1bdf28baf9d262cd8be2955c63a..a4be6e7b1652f1cf1f280ce9311fbaa93220abbc 100644 (file)
@@ -6772,7 +6772,16 @@ get_std_lbound (gfc_expr *expr, tree desc, int dim, bool assumed_size)
                              gfc_array_index_type, cond,
                              lbound, gfc_index_one_node);
     }
-  else if (expr->expr_type == EXPR_VARIABLE)
+
+  if (expr->expr_type == EXPR_FUNCTION)
+    {
+      /* A conversion function, so use the argument.  */
+      gcc_assert (expr->value.function.isym
+                 && expr->value.function.isym->conversion);
+      expr = expr->value.function.actual->expr;
+    }
+
+  if (expr->expr_type == EXPR_VARIABLE)
     {
       tmp = TREE_TYPE (expr->symtree->n.sym->backend_decl);
       for (ref = expr->ref; ref; ref = ref->next)
@@ -6785,15 +6794,6 @@ get_std_lbound (gfc_expr *expr, tree desc, int dim, bool assumed_size)
        }
       return GFC_TYPE_ARRAY_LBOUND(tmp, dim);
     }
-  else if (expr->expr_type == EXPR_FUNCTION)
-    {
-      /* A conversion function, so use the argument.  */
-      expr = expr->value.function.actual->expr;
-      if (expr->expr_type != EXPR_VARIABLE)
-       return gfc_index_one_node;
-      desc = TREE_TYPE (expr->symtree->n.sym->backend_decl);
-      return get_std_lbound (expr, desc, dim, assumed_size);
-    }
 
   return gfc_index_one_node;
 }
index d389970df6cdecb1f4e6d6a86bef8e4430b9582e..1d94277b83400324b16ecf2424f43a282ddaba6e 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-08  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/51448
+       * gfortran.dg/realloc_on_assign_8.f90: New.
+
 2011-12-08  Teresa Johnson  <tejohnson@google.com>
 
        * gcc.target/i386/movdi-rex64.c: Remove unnecessary
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90
new file mode 100644 (file)
index 0000000..4f7d288
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR fortran/51448
+!
+! Contribued by François Willot
+!
+  PROGRAM MAIN
+  IMPLICIT NONE
+  TYPE mytype
+    REAL b(2)
+  END TYPE mytype
+  TYPE(mytype) a
+  DOUBLE PRECISION, ALLOCATABLE :: x(:)
+  ALLOCATE(x(2))
+  a%b=0.0E0
+  x=a%b
+  END