aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.cc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2024-12-23 15:32:40 +0000
committerPaul Thomas <pault@gcc.gnu.org>2024-12-23 15:33:09 +0000
commitd21efb65d15273d50ca80aea14787efa6245174c (patch)
treed2479d1f5a3987fcebf86542b073c03823c85744 /gcc/fortran/trans-expr.cc
parentb43bb6591f7f934f9807a2cae3b53fdbe8d27169 (diff)
downloadgcc-d21efb65d15273d50ca80aea14787efa6245174c.zip
gcc-d21efb65d15273d50ca80aea14787efa6245174c.tar.gz
gcc-d21efb65d15273d50ca80aea14787efa6245174c.tar.bz2
Fortran: Bugs found in class_transformational_1/2.f90[PR116254/118059].
2024-12-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran/ChangeLog PR fortran/116254 * trans-array.cc (gfc_trans_create_temp_array): Make sure that transformational intrinsics of class objects that change rank, most particularly spread, go through the correct code path. Re- factor so that changes to the dtype are done on the temporary before the class data of the result points to it. PR fortran/118059 * trans-expr.cc (arrayfunc_assign_needs_temporary): Character array function expressions assigned to an unlimited polymorphic variable require a temporary.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
-rw-r--r--gcc/fortran/trans-expr.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 34891af..9aedecb 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -11445,6 +11445,9 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2)
character lengths are the same. */
if (expr2->ts.type == BT_CHARACTER && expr2->rank > 0)
{
+ if (UNLIMITED_POLY (expr1))
+ return true;
+
if (expr1->ts.u.cl->length == NULL
|| expr1->ts.u.cl->length->expr_type != EXPR_CONSTANT)
return true;