Commit b0369790 by Steven G. Kargl

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
parent fb5621b1
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
......
......@@ -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;
......
2017-11-08 Steven G. Kargl <kargl@kgcc.gnu.org>
PR Fortran/82841
* gfortran.dg/transfer_simplify_11.f90: New test.
2017-11-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/82884
......
! { dg-do run }
! PR Fortran/82841
!
integer, parameter :: N = 2
character(len=1) :: chr(N)
chr = transfer(repeat("x",ncopies=N),[character(len=1) ::], N)
if (chr(1) /= 'x' .and. chr(2) /= 'x') call abort
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment