diff options
author | Richard Biener <rguenther@suse.de> | 2019-01-08 10:46:04 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-01-08 10:46:04 +0000 |
commit | eb4a91451a293020a497e5dc1d41667af8b16eea (patch) | |
tree | 13540aebaea57a6ef2d80b80ec6487d5c1e17986 /gcc/fortran/trans-expr.c | |
parent | efac62a3d17d534e8fec39a53031689efb0dc724 (diff) | |
download | gcc-eb4a91451a293020a497e5dc1d41667af8b16eea.zip gcc-eb4a91451a293020a497e5dc1d41667af8b16eea.tar.gz gcc-eb4a91451a293020a497e5dc1d41667af8b16eea.tar.bz2 |
re PR fortran/88611 (ICE in eliminate_stmt, at tree-ssa-sccvn.c:5011)
2019-01-08 Richard Biener <rguenther@suse.de>
PR fortran/88611
* trans-expr.c (gfc_conv_initializer): For ISOCBINDING_NULL_*
directly build the expected GENERIC tree.
* gfortran.dg/pr88611.f90: New testcase.
From-SVN: r267721
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 27eb2d2..c45752e 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -7086,19 +7086,12 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type, if (expr != NULL && expr->ts.type == BT_DERIVED && expr->ts.is_iso_c && expr->ts.u.derived) { - gfc_symbol *derived = expr->ts.u.derived; - - /* The derived symbol has already been converted to a (void *). Use - its kind. */ - if (derived->ts.kind == 0) - derived->ts.kind = gfc_default_integer_kind; - expr = gfc_get_int_expr (derived->ts.kind, NULL, 0); - expr->ts.f90_type = derived->ts.f90_type; - - gfc_init_se (&se, NULL); - gfc_conv_constant (&se, expr); - gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR); - return se.expr; + if (TREE_CODE (type) == ARRAY_TYPE) + return build_constructor (type, NULL); + else if (POINTER_TYPE_P (type)) + return build_int_cst (type, 0); + else + gcc_unreachable (); } if (array && !procptr) |