aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2017-11-08 22:56:58 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2017-11-08 22:56:58 +0000
commitb036979093e912243a4ff999a50feb86fe6f7889 (patch)
treeedd4daf21b07035131c368cddec9626932a8eb1e /gcc/fortran
parentfb5621b1841b56a88f66fb1e08dd87db0009c57b (diff)
downloadgcc-b036979093e912243a4ff999a50feb86fe6f7889.zip
gcc-b036979093e912243a4ff999a50feb86fe6f7889.tar.gz
gcc-b036979093e912243a4ff999a50feb86fe6f7889.tar.bz2
re PR fortran/82841 (Segfault in gfc_simplify_transfer)
2017-11-08 Steven G. Kargl <kargl@kgcc.gnu.org> PR Fortran/82841 * simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer. Unwrap a short line. 2017-11-08 Steven G. Kargl <kargl@kgcc.gnu.org> PR Fortran/82841 * gfortran.dg/transfer_simplify_11.f90: new test. From-SVN: r254555
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/simplify.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b554f9f..6c9f246 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-08 Steven G. Kargl <kargl@kgcc.gnu.org>
+
+ PR Fortran/82841
+ * simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer.
+ Unwrap a short line.
+
2017-11-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/82884
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index ba010a0..c7b7e1a 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -6576,8 +6576,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
return NULL;
/* Calculate the size of the source. */
- if (source->expr_type == EXPR_ARRAY
- && !gfc_array_size (source, &tmp))
+ if (source->expr_type == EXPR_ARRAY && !gfc_array_size (source, &tmp))
gfc_internal_error ("Failure getting length of a constant array.");
/* Create an empty new expression with the appropriate characteristics. */
@@ -6585,7 +6584,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
&source->where);
result->ts = mold->ts;
- mold_element = mold->expr_type == EXPR_ARRAY
+ mold_element = (mold->expr_type == EXPR_ARRAY && mold->value.constructor)
? gfc_constructor_first (mold->value.constructor)->expr
: mold;