aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-12-08 19:51:28 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2011-12-08 19:51:28 +0100
commite48cc3915567359131c25e8453182150d4a66b56 (patch)
tree72dc960245648db7c70fe4680582fee6ad01a6ca /gcc
parentd62023228ddc5ee21a7d0c6297dedba3e1783848 (diff)
downloadgcc-e48cc3915567359131c25e8453182150d4a66b56.zip
gcc-e48cc3915567359131c25e8453182150d4a66b56.tar.gz
gcc-e48cc3915567359131c25e8453182150d4a66b56.tar.bz2
re PR fortran/51448 (Compiler crash when assigning floating point values of different kinds)
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: r182131
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-array.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_8.f9017
4 files changed, 38 insertions, 10 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d90aad1..7273681 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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-08 Toon Moene <toon@moene.org>
PR fortran/51310
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index ee8f896..c8624d9 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7428,7 +7428,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)
@@ -7441,15 +7450,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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 750b23f..66645cd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-07 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
index 0000000..4f7d288
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90
@@ -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