diff options
author | Paul Thomas <pault@pc30.home> | 2020-03-01 16:04:38 +0000 |
---|---|---|
committer | Paul Thomas <pault@pc30.home> | 2020-03-01 16:04:38 +0000 |
commit | 7067f8c814088c1d02e40adf79a80f5ec53dbdde (patch) | |
tree | e125c995cd90503416bc6c26ecb7224826889fdb /gcc/fortran | |
parent | 63cc547f6d85819192afa795e9ade14f0800eda9 (diff) | |
download | gcc-7067f8c814088c1d02e40adf79a80f5ec53dbdde.zip gcc-7067f8c814088c1d02e40adf79a80f5ec53dbdde.tar.gz gcc-7067f8c814088c1d02e40adf79a80f5ec53dbdde.tar.bz2 |
Patch for PR92959
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 2567dc9..00bec1e 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -8573,7 +8573,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) gfc_se arg2se; tree tmp2; tree tmp; - tree nonzero_charlen; tree nonzero_arraylen; gfc_ss *ss; bool scalar; @@ -8629,13 +8628,6 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) if (arg2->expr->ts.type == BT_CLASS) gfc_add_data_component (arg2->expr); - nonzero_charlen = NULL_TREE; - if (arg1->expr->ts.type == BT_CHARACTER) - nonzero_charlen = fold_build2_loc (input_location, NE_EXPR, - logical_type_node, - arg1->expr->ts.u.cl->backend_decl, - build_zero_cst - (TREE_TYPE (arg1->expr->ts.u.cl->backend_decl))); if (scalar) { /* A pointer to a scalar. */ @@ -8705,10 +8697,15 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) /* If target is present zero character length pointers cannot be associated. */ - if (nonzero_charlen != NULL_TREE) - se->expr = fold_build2_loc (input_location, TRUTH_AND_EXPR, - logical_type_node, - se->expr, nonzero_charlen); + if (arg1->expr->ts.type == BT_CHARACTER) + { + tmp = arg1se.string_length; + tmp = fold_build2_loc (input_location, NE_EXPR, + logical_type_node, tmp, + build_zero_cst (TREE_TYPE (tmp))); + se->expr = fold_build2_loc (input_location, TRUTH_AND_EXPR, + logical_type_node, se->expr, tmp); + } } se->expr = convert (gfc_typenode_for_spec (&expr->ts), se->expr); |