diff options
author | Mikael Morin <mikael.morin@tele2.fr> | 2008-12-09 20:12:27 +0100 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2008-12-09 19:12:27 +0000 |
commit | fe7a047c75f5a96456ea750a9f91ff41786a23e9 (patch) | |
tree | 98f291a107f72f26d297b79987efe4473c0f40cc /gcc/fortran/trans-expr.c | |
parent | b922b5ae3258177415b64a230ce49cea9ef87172 (diff) | |
download | gcc-fe7a047c75f5a96456ea750a9f91ff41786a23e9.zip gcc-fe7a047c75f5a96456ea750a9f91ff41786a23e9.tar.gz gcc-fe7a047c75f5a96456ea750a9f91ff41786a23e9.tar.bz2 |
re PR fortran/35983 (C_LOC in derived type constructor gives weird result)
2008-12-09 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/35983
* trans-expr.c (gfc_trans_subcomponent_assign):
Add se's pre and post blocks to current block.
(gfc_trans_structure_assign): Remove specific handling
of C_NULL_PTR and C_NULL_FUNPTR.
2008-12-09 Mikael Morin <mikael.morin@tele2.fr>
PR fortran/35983
* gfortran.dg/pr35983.f90: New test.
From-SVN: r142605
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 5d3894c..4ecfa08 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3670,8 +3670,10 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) { gfc_init_se (&se, NULL); gfc_conv_expr (&se, expr); + gfc_add_block_to_block (&block, &se.pre); gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest), se.expr)); + gfc_add_block_to_block (&block, &se.post); } else { @@ -3713,21 +3715,8 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr) { /* Skip absent members in default initializers. */ if (!c->expr) - continue; + continue; - /* Update the type/kind of the expression if it represents either - C_NULL_PTR or C_NULL_FUNPTR. This is done here because this may - be the first place reached for initializing output variables that - have components of type C_PTR/C_FUNPTR that are initialized. */ - if (c->expr->ts.type == BT_DERIVED && c->expr->ts.derived - && c->expr->ts.derived->attr.is_iso_c) - { - c->expr->expr_type = EXPR_NULL; - c->expr->ts.type = c->expr->ts.derived->ts.type; - c->expr->ts.f90_type = c->expr->ts.derived->ts.f90_type; - c->expr->ts.kind = c->expr->ts.derived->ts.kind; - } - field = cm->backend_decl; tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (field), dest, field, NULL_TREE); |