https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119273

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-03-13
           Priority|P3                          |P4
     Ever confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |14.2.1, 15.0
   Target Milestone|---                         |14.3
            Summary|subclass can not correctly  |[14/15 Regression] subclass
                   |access to superclass in     |can not correctly access to
                   |associate statement         |superclass in associate
                   |                            |statement

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

gfortran-13 did not generate bounds-checking for the code in question.

The current version seems to invoke test_function twice with fcheck=bounds,
with the first call (for the bounds-checking) using a wrong argument where
the vptr is not set up:

    struct __class_test_module_Test_type_child_t class.0;
    integer(kind=8) D.4855;
    struct __class_test_module_Test_type_child_t class.1;
    integer(kind=8) D.4857;

    a.test_type_father.val = 1;
    D.4855 = (integer(kind=8)) test_function (&class.0);
    if (D.4855 <= 0)
      {
        _gfortran_runtime_error_at (&"At line 29 of file pr119273.f90"[1]{lb: 1
sz: 1}, &"Index \'%ld\' of dimension 2 of array \'temp_int\' outside of
expected range (%ld:%ld)"[1]{lb: 1 sz: 1}, D.4855, 1, 1);
      }
    if (D.4855 > 1)
      {
        _gfortran_runtime_error_at (&"At line 29 of file pr119273.f90"[1]{lb: 1
sz: 1}, &"Index \'%ld\' of dimension 2 of array \'temp_int\' outside of
expected range (%ld:%ld)"[1]{lb: 1 sz: 1}, D.4855, 1, 1);
      }
    class.1._vptr = (struct __vtype_test_module_Test_type_child * {ref-all})
&__vtab_test_module_Test_type_child;
    class.1._data = &a;
    D.4857 = (integer(kind=8)) test_function (&class.1);

Reply via email to