diff options
author | Harald Anlauf <anlauf@gmx.de> | 2025-03-19 22:56:03 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2025-03-19 23:36:33 +0100 |
commit | 3292ca9b0818c3e55102413c2407711d0755d280 (patch) | |
tree | a14f9159b9d65a17cd5a8b3189e7d41050cb5016 /gcc/fortran/trans-array.cc | |
parent | 80e1dac3849b134ebd5e0151e9c9e4b8b091de72 (diff) | |
download | gcc-3292ca9b0818c3e55102413c2407711d0755d280.zip gcc-3292ca9b0818c3e55102413c2407711d0755d280.tar.gz gcc-3292ca9b0818c3e55102413c2407711d0755d280.tar.bz2 |
Fortran: fix bogus bounds check for reallocation on assignment [PR116706]
PR fortran/116706
gcc/fortran/ChangeLog:
* trans-array.cc (gfc_is_reallocatable_lhs): Fix check on
allocatable components of derived type or class objects.
gcc/testsuite/ChangeLog:
* gfortran.dg/bounds_check_27.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-array.cc')
-rw-r--r-- | gcc/fortran/trans-array.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 8ab290b..e9eacf2 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -11236,9 +11236,7 @@ gfc_is_reallocatable_lhs (gfc_expr *expr) return true; /* All that can be left are allocatable components. */ - if ((sym->ts.type != BT_DERIVED - && sym->ts.type != BT_CLASS) - || !sym->ts.u.derived->attr.alloc_comp) + if (sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS) return false; /* Find a component ref followed by an array reference. */ |