[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 anlauf at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|--- |14.2 Status|NEW |RESOLVED --- Comment #7 from anlauf at gcc dot gnu.org --- Fixed on mainline for gcc-15, and backported to 14-branch. Closing. Thanks for the report, and sorry that it took so long to fix.
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 --- Comment #6 from GCC Commits --- The releases/gcc-14 branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:b0b21d5bdfbc7d417b70010a11354b44968bb184 commit r14-10244-gb0b21d5bdfbc7d417b70010a11354b44968bb184 Author: Harald Anlauf Date: Mon May 13 22:06:33 2024 +0200 Fortran: fix bounds check for assignment, class component [PR86100] gcc/fortran/ChangeLog: PR fortran/86100 * trans-array.cc (gfc_conv_ss_startstride): Use abridged_ref_name to generate a more user-friendly name for bounds-check messages. * trans-expr.cc (gfc_copy_class_to_class): Fix bounds check for rank>1 by looping over the dimensions. gcc/testsuite/ChangeLog: PR fortran/86100 * gfortran.dg/bounds_check_25.f90: New test. (cherry picked from commit 93765736815a049e14d985b758a213cfe60c1e1c)
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 --- Comment #5 from GCC Commits --- The master branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:93765736815a049e14d985b758a213cfe60c1e1c commit r15-827-g93765736815a049e14d985b758a213cfe60c1e1c Author: Harald Anlauf Date: Mon May 13 22:06:33 2024 +0200 Fortran: fix bounds check for assignment, class component [PR86100] gcc/fortran/ChangeLog: PR fortran/86100 * trans-array.cc (gfc_conv_ss_startstride): Use abridged_ref_name to generate a more user-friendly name for bounds-check messages. * trans-expr.cc (gfc_copy_class_to_class): Fix bounds check for rank>1 by looping over the dimensions. gcc/testsuite/ChangeLog: PR fortran/86100 * gfortran.dg/bounds_check_25.f90: New test.
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 anlauf at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org Keywords||wrong-code --- Comment #4 from anlauf at gcc dot gnu.org --- Submitted: https://gcc.gnu.org/pipermail/fortran/2024-May/060512.html
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 --- Comment #3 from anlauf at gcc dot gnu.org --- The code fragment in comment#2 was added in r7-3760-g92c5266bbd5378.
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 anlauf at gcc dot gnu.org changed: What|Removed |Added CC||anlauf at gcc dot gnu.org --- Comment #2 from anlauf at gcc dot gnu.org --- The problem seems to generally occur for class components of derived types. program p implicit none type t integer :: i = 0 end type t type any_matrix class(t), allocatable :: m(:,:) end type any_matrix type(any_matrix) :: a, b allocate(a%m(3,4)) call foo () contains subroutine foo () b = a ! Array bound mismatch for dimension 1 of array '<>' (12/3) !b%m = a%m ! no runtime error with -fcheck=bounds end subroutine foo end This fails as indicated. Note that 12=3*4 is the total size of the array, and 3 is the size of the first dimension, which - along with the '<>' - points to gfc_copy_class_to_class: from_len = gfc_conv_descriptor_size (from_data, 1); from_len = fold_convert (TREE_TYPE (orig_nelems), from_len); tmp = fold_build2_loc (input_location, NE_EXPR, logical_type_node, from_len, orig_nelems); msg = xasprintf ("Array bound mismatch for dimension %d " "of array '%s' (%%ld/%%ld)", 1, name); gfc_trans_runtime_check (true, false, tmp, &body, &gfc_current_locus, msg, fold_convert (long_integer_type_node, orig_nelems), fold_convert (long_integer_type_node, from_len)); So we compare dimension 1 and the full size of the rhs? Shouldn't we compare lhs and rhs shapes?
[Bug fortran/86100] Spurious error with -fcheck=bounds and allocatable class(*) array components
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86100 Dominique d'Humieres changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-06-10 Blocks||27766 Ever confirmed|0 |1 --- Comment #1 from Dominique d'Humieres --- Confirmed from 6.4.0 up to trunk (9.0). Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27766 [Bug 27766] [meta-bug] -fbounds-check related bugs