[Bug fortran/127233] ASSOCIATED ignores element length
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 16 12:49:35 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127233
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |127413
--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #5)
> (In reply to Mikael Morin from comment #4)
> > FAIL: gfortran.dg/PR100120.f90
>
> For this one, stripped down:
>
> integer, parameter :: n = 11
>
> type :: foo_t
> integer :: i
> end type foo_t
>
> type, extends(foo_t) :: bar_t
> integer :: j(n)
> end type bar_t
>
> type(bar_t), target :: abd(n)
> class(foo_t), pointer :: apf(:)
>
> apf => abd
> if(.not.associated(apf, abd)) stop 13
>
>
> we generate:
>
> (...)
> apf._data.span = 48;
> apf._data.dtype = {.elem_len=4, .version=0, .rank=1, .type=5};
> (...)
> parm.0.span = 48;
> parm.0.dtype = {.elem_len=48, .version=0, .rank=1, .type=5};
> (...)
> if (_gfortran_associated (&apf._data, &parm.0) == 0 ...)
> (...)
>
> so the element length in the pointer assignment is wrong.
I have opened PR127413 for this.
Setting a dependency on it.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127413
[Bug 127413] Array pointer assignment doesn't correctly set the element length
More information about the Gcc-bugs
mailing list