]> git.ipfire.org Git - people/ms/gcc.git/commit
Fortran: fix bounds check for copying of class expressions [PR106945]
authorHarald Anlauf <anlauf@gmx.de>
Sat, 11 Mar 2023 14:37:37 +0000 (15:37 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Wed, 15 Mar 2023 20:11:13 +0000 (21:11 +0100)
commit82ca86233da61e868a91b6132191148230d56ab0
tree17431bf96db205c43a90bc3591b2984356899383
parent21139744aff3a9cb751f046755abb02ece5b3dcf
Fortran: fix bounds check for copying of class expressions [PR106945]

In the bounds check for copying of class expressions, the number of elements
determined from a descriptor, returned as type gfc_array_index_type (i.e. a
signed type), should be converted to the type of the passed element count,
which is of type size_type_node (i.e. unsigned), for use in comparisons.

gcc/fortran/ChangeLog:

PR fortran/106945
* trans-expr.cc (gfc_copy_class_to_class): Convert element counts in
bounds check to common type for comparison.

gcc/testsuite/ChangeLog:

PR fortran/106945
* gfortran.dg/pr106945.f90: New test.

(cherry picked from commit 2cf5f485e0351bb1faf46196a99e524688f3966e)
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/pr106945.f90 [new file with mode: 0644]