aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2016-08-08 11:58:21 +0200
committerAndre Vehreschild <vehre@gcc.gnu.org>2016-08-08 11:58:21 +0200
commit7090cac9f7c9aabd4ad252e6d49b42bdcac85f67 (patch)
tree2aecfc38f65dabcc6205d34a288024cf1c120249 /gcc/fortran
parent64e56ab026b20babdf4ac0b07c20ab5b9c3e0b1e (diff)
downloadgcc-7090cac9f7c9aabd4ad252e6d49b42bdcac85f67.zip
gcc-7090cac9f7c9aabd4ad252e6d49b42bdcac85f67.tar.gz
gcc-7090cac9f7c9aabd4ad252e6d49b42bdcac85f67.tar.bz2
re PR fortran/71936 (ICE in wide_int_to_tree, at tree.c:1487)
gcc/fortran/ChangeLog: 2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/71936 * trans-array.c (gfc_array_allocate): When SOURCE= is a function stick with the ref of the object to allocate. gcc/testsuite/ChangeLog: 2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/71936 * gfortran.dg/allocate_with_source_21.f03: New test. From-SVN: r239237
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-array.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3b54ee3..6a56ed0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org>
+ PR fortran/71936
+ * trans-array.c (gfc_array_allocate): When SOURCE= is a function
+ stick with the ref of the object to allocate.
+
+2016-08-08 Andre Vehreschild <vehre@gcc.gnu.org>
+
PR fortran/72698
* trans-stmt.c (gfc_trans_allocate): Prevent generating code for
copy of zero sized string and with it an ICE.
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 0a66f83..450d7db 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -5431,12 +5431,19 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
if (ref->u.ar.type == AR_FULL && expr3 != NULL)
{
+ gfc_ref *old_ref = ref;
/* F08:C633: Array shape from expr3. */
ref = expr3->ref;
/* Find the last reference in the chain. */
if (!retrieve_last_ref (&ref, &prev_ref))
- return false;
+ {
+ if (expr3->expr_type == EXPR_FUNCTION
+ && gfc_expr_attr (expr3).dimension)
+ ref = old_ref;
+ else
+ return false;
+ }
alloc_w_e3_arr_spec = true;
}