diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2009-05-10 10:21:08 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2009-05-10 10:21:08 +0000 |
commit | 110ea21a35fb1ef78b0f6a38567446417f04e364 (patch) | |
tree | b0276501ec4fd45f4455eecb2ced44a2530c73e9 /gcc | |
parent | 896d7dbd746289b7cdc08505f56860bd73ec5998 (diff) | |
download | gcc-110ea21a35fb1ef78b0f6a38567446417f04e364.zip gcc-110ea21a35fb1ef78b0f6a38567446417f04e364.tar.gz gcc-110ea21a35fb1ef78b0f6a38567446417f04e364.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 |
3 files changed, 18 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bf28737..6413f11 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,12 @@ 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 * trans-expr.c (gfc_conv_operator_assign): Remove function. * trans.h : Remove prototype for gfc_conv_operator_assign. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 47f4e0c..71db46d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1263,10 +1263,11 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, gfc_init_se (&se, NULL); 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 an array of pointers. */ - if (p->expr->ts.type == BT_CHARACTER - && POINTER_TYPE_P (type)) + else if (POINTER_TYPE_P (type)) se.expr = gfc_build_addr_expr (gfc_get_pchar_type (p->expr->ts.kind), se.expr); @@ -1620,7 +1621,9 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type) { gfc_init_se (&se, NULL); 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); list = tree_cons (build_int_cst (gfc_array_index_type, nelem), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e875a66..017cbf4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> PR tree-optimization/40081 |