Commit 110ea21a by Paul Thomas

re PR fortran/40018 (ICE in output_constructor)

2009-05-10  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40018
	* trans-array.c (gfc_trans_array_constructor_value): Fold
	convert numeric constants.
	(gfc_build_constant_array_constructor): The same.

2009-05-10  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40018
	* gfortran.dg/array_constructor_31.f90: New test.

From-SVN: r147331
parent 896d7dbd
2009-05-10 Paul Thomas <pault@gcc.gnu.org> 2009-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40018
* trans-array.c (gfc_trans_array_constructor_value): Fold
convert numeric constants.
(gfc_build_constant_array_constructor): The same.
2009-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38863 PR fortran/38863
* trans-expr.c (gfc_conv_operator_assign): Remove function. * trans-expr.c (gfc_conv_operator_assign): Remove function.
* trans.h : Remove prototype for gfc_conv_operator_assign. * trans.h : Remove prototype for gfc_conv_operator_assign.
......
...@@ -1263,10 +1263,11 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, ...@@ -1263,10 +1263,11 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
gfc_init_se (&se, NULL); gfc_init_se (&se, NULL);
gfc_conv_constant (&se, p->expr); gfc_conv_constant (&se, p->expr);
if (c->expr->ts.type != BT_CHARACTER)
se.expr = fold_convert (type, se.expr);
/* For constant character array constructors we build /* For constant character array constructors we build
an array of pointers. */ an array of pointers. */
if (p->expr->ts.type == BT_CHARACTER else if (POINTER_TYPE_P (type))
&& POINTER_TYPE_P (type))
se.expr = gfc_build_addr_expr se.expr = gfc_build_addr_expr
(gfc_get_pchar_type (p->expr->ts.kind), (gfc_get_pchar_type (p->expr->ts.kind),
se.expr); se.expr);
...@@ -1620,7 +1621,9 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type) ...@@ -1620,7 +1621,9 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type)
{ {
gfc_init_se (&se, NULL); gfc_init_se (&se, NULL);
gfc_conv_constant (&se, c->expr); gfc_conv_constant (&se, c->expr);
if (c->expr->ts.type == BT_CHARACTER && POINTER_TYPE_P (type)) if (c->expr->ts.type != BT_CHARACTER)
se.expr = fold_convert (type, se.expr);
else if (POINTER_TYPE_P (type))
se.expr = gfc_build_addr_expr (gfc_get_pchar_type (c->expr->ts.kind), se.expr = gfc_build_addr_expr (gfc_get_pchar_type (c->expr->ts.kind),
se.expr); se.expr);
list = tree_cons (build_int_cst (gfc_array_index_type, nelem), list = tree_cons (build_int_cst (gfc_array_index_type, nelem),
......
2009-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40018
* gfortran.dg/array_constructor_31.f90: New test.
2009-05-10 Richard Guenther <rguenther@suse.de> 2009-05-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40081 PR tree-optimization/40081
......
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