aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-11-10 12:24:24 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-11-10 12:24:24 +0000
commit8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e (patch)
tree14b398d7e1063d2eaaec7b3e0c7797797beeb428 /gcc/fortran
parent9e875fd864e1ddf636c015a35985bccf732b645a (diff)
downloadgcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.zip
gcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.tar.gz
gcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.tar.bz2
re PR fortran/82934 (Segfault on assumed character length in allocate)
2017-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/82934 * trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on null string length for assumed length typespec and set expr3_esize to NULL_TREE; 2017-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/82934 * gfortran.dg/allocate_assumed_charlen_1.f90: New test. From-SVN: r254624
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-stmt.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7d01627..fb067aa 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82934
+ * trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on
+ null string length for assumed length typespec and set
+ expr3_esize to NULL_TREE;
+
2017-11-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/78619
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index d058e5f..ea0f952 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -5913,10 +5913,9 @@ gfc_trans_allocate (gfc_code * code)
if (code->ext.alloc.ts.type != BT_CHARACTER)
expr3_esize = TYPE_SIZE_UNIT (
gfc_typenode_for_spec (&code->ext.alloc.ts));
- else
+ else if (code->ext.alloc.ts.u.cl->length != NULL)
{
gfc_expr *sz;
- gcc_assert (code->ext.alloc.ts.u.cl->length != NULL);
sz = gfc_copy_expr (code->ext.alloc.ts.u.cl->length);
gfc_init_se (&se_sz, NULL);
gfc_conv_expr (&se_sz, sz);
@@ -5930,6 +5929,8 @@ gfc_trans_allocate (gfc_code * code)
tmp, se_sz.expr);
expr3_esize = gfc_evaluate_now (expr3_esize, &block);
}
+ else
+ expr3_esize = NULL_TREE;
}
/* The routine gfc_trans_assignment () already implements all