aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2018-09-30 12:22:07 +0000
committerPaul Thomas <pault@gcc.gnu.org>2018-09-30 12:22:07 +0000
commitba08c70a0c73b9fef5b78e2e5706845aa85c4df7 (patch)
tree52932d1b845b28c268d7a49e53166ffcfb5b5e55 /gcc/fortran/trans.c
parentf1525dd4b4c4e57e8dd6f1c1a90f1a148b3da945 (diff)
downloadgcc-ba08c70a0c73b9fef5b78e2e5706845aa85c4df7.zip
gcc-ba08c70a0c73b9fef5b78e2e5706845aa85c4df7.tar.gz
gcc-ba08c70a0c73b9fef5b78e2e5706845aa85c4df7.tar.bz2
re PR fortran/70752 (Incorrect LEN for ALLOCATABLE CHARACTER)
2018-09-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/70752 PR fortran/72709 * trans-array.c (gfc_conv_scalarized_array_ref): If this is a deferred type and the info->descriptor is present, use the info->descriptor (gfc_conv_array_ref): Is the se expr is a descriptor type, pass it as 'decl' rather than the symbol backend_decl. (gfc_array_allocate): If the se string_length is a component reference, fix it and use it for the expression string length if the latter is not a variable type. If it is a variable do an assignment. Make use of component ref string lengths to set the descriptor 'span'. (gfc_conv_expr_descriptor): For pointer assignment, do not set the span field if gfc_get_array_span returns zero. * trans.c (get_array_span): If the upper bound a character type is zero, use the descriptor span if available. 2018-09-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/70752 PR fortran/72709 * gfortran.dg/deferred_character_25.f90 : New test. * gfortran.dg/deferred_character_26.f90 : New test. * gfortran.dg/deferred_character_27.f90 : New test to verify that PR82617 remains fixed. From-SVN: r264724
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r--gcc/fortran/trans.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 03dc7a2..9297b2f 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -307,6 +307,15 @@ get_array_span (tree type, tree decl)
TYPE_SIZE_UNIT (TREE_TYPE (type))),
span);
}
+ else if (type && TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != NULL_TREE
+ && integer_zerop (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))
+ {
+ if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
+ span = gfc_conv_descriptor_span_get (decl);
+ else
+ span = NULL_TREE;
+ }
/* Likewise for class array or pointer array references. */
else if (TREE_CODE (decl) == FIELD_DECL
|| VAR_OR_FUNCTION_DECL_P (decl)