Re: [Patch, fortran] PR117797 - [13/14/15 Regression] ICE in gfc_get_array_span

2024-12-10 Thread Andre Vehreschild
Hi Paul,

no, I don't have an example in mind out of the box.

May be something like:

type :: T
  character :: s(:)
  character :: c
end type

class(T) :: foo(2)

But that is just a guess. I was triggered only by the first condition your
patch removes, where span was used instead of the of element-size. I was more
or less just curious. Let's see what time brings to our regression shores.

- Andre

On Tue, 10 Dec 2024 17:45:09 +
Paul Richard Thomas  wrote:

> Hi Andre,
>
> I don't think that's possible but I am prepared to be proven wrong :-) Do
> you have an example in mind, where this might happen?
>
> Regards
>
> Paul
>
>
> On Tue, 10 Dec 2024 at 10:52, Andre Vehreschild  wrote:
>
> > Hi Paul,
> >
> > in principle the patch looks sound, but is the vptr_size always the same
> > as a
> > descriptor->span? Can't the later be larger because of padding? If that is
> > the
> > case, then the first `else if (UNLIMITED...` you removed in
> > `gfc_get_array_span
> > ()` would return a larger number.
> >
> > Regards,
> > Andre
> >
> > On Tue, 10 Dec 2024 10:10:07 +
> > Paul Richard Thomas  wrote:
> >
> > > Hi All,
> > >
> > > This was yet another regression that I caused, which was backported and
> > so
> > > I am rather anxious to fix it promptly.
> > >
> > > The modifications that I made to gfc_get_array_span caused
> > > unlimited polymorphic array components to be missed, when contained in a
> > > dummy. Instead, the dummy was taken to be the class container, which then
> > > caused the segfault
> > >
> > > I took the opportunity to refactor gfc_get_array_span such that it is now
> > > improved over its original form. Class data descriptors now cannot be
> > > missed for any declared type. The new helper function
> > > 'class_array_element_size' extracts the vptr from both the class object
> > and
> > > from class dummies. The vptr size is then returned, except in the case of
> > > unlimited polymorphic expressions, where the vptr size must be corrected
> > > with the _len value. The class container is unambiguously obtainable from
> > > the vptr.
> > >
> > > Regression tests - OK for mainline and then, after a short while,
> > > backported to the affected branches?
> > >
> > > Paul
> >
> >
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de
> >


--
Andre Vehreschild * Email: vehre ad gmx dot de


Re: [Patch, fortran] PR117797 - [13/14/15 Regression] ICE in gfc_get_array_span

2024-12-10 Thread Paul Richard Thomas
Hi Andre,

I don't think that's possible but I am prepared to be proven wrong :-) Do
you have an example in mind, where this might happen?

Regards

Paul


On Tue, 10 Dec 2024 at 10:52, Andre Vehreschild  wrote:

> Hi Paul,
>
> in principle the patch looks sound, but is the vptr_size always the same
> as a
> descriptor->span? Can't the later be larger because of padding? If that is
> the
> case, then the first `else if (UNLIMITED...` you removed in
> `gfc_get_array_span
> ()` would return a larger number.
>
> Regards,
> Andre
>
> On Tue, 10 Dec 2024 10:10:07 +
> Paul Richard Thomas  wrote:
>
> > Hi All,
> >
> > This was yet another regression that I caused, which was backported and
> so
> > I am rather anxious to fix it promptly.
> >
> > The modifications that I made to gfc_get_array_span caused
> > unlimited polymorphic array components to be missed, when contained in a
> > dummy. Instead, the dummy was taken to be the class container, which then
> > caused the segfault
> >
> > I took the opportunity to refactor gfc_get_array_span such that it is now
> > improved over its original form. Class data descriptors now cannot be
> > missed for any declared type. The new helper function
> > 'class_array_element_size' extracts the vptr from both the class object
> and
> > from class dummies. The vptr size is then returned, except in the case of
> > unlimited polymorphic expressions, where the vptr size must be corrected
> > with the _len value. The class container is unambiguously obtainable from
> > the vptr.
> >
> > Regression tests - OK for mainline and then, after a short while,
> > backported to the affected branches?
> >
> > Paul
>
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
>


Re: [Patch, fortran] PR117797 - [13/14/15 Regression] ICE in gfc_get_array_span

2024-12-10 Thread Andre Vehreschild
Hi Paul,

in principle the patch looks sound, but is the vptr_size always the same as a
descriptor->span? Can't the later be larger because of padding? If that is the
case, then the first `else if (UNLIMITED...` you removed in `gfc_get_array_span
()` would return a larger number.

Regards,
Andre

On Tue, 10 Dec 2024 10:10:07 +
Paul Richard Thomas  wrote:

> Hi All,
>
> This was yet another regression that I caused, which was backported and so
> I am rather anxious to fix it promptly.
>
> The modifications that I made to gfc_get_array_span caused
> unlimited polymorphic array components to be missed, when contained in a
> dummy. Instead, the dummy was taken to be the class container, which then
> caused the segfault
>
> I took the opportunity to refactor gfc_get_array_span such that it is now
> improved over its original form. Class data descriptors now cannot be
> missed for any declared type. The new helper function
> 'class_array_element_size' extracts the vptr from both the class object and
> from class dummies. The vptr size is then returned, except in the case of
> unlimited polymorphic expressions, where the vptr size must be corrected
> with the _len value. The class container is unambiguously obtainable from
> the vptr.
>
> Regression tests - OK for mainline and then, after a short while,
> backported to the affected branches?
>
> Paul


--
Andre Vehreschild * Email: vehre ad gmx dot de