[Bug fortran/109066] Segfault when using defined assignment

2023-03-10 Thread paul.richard.thomas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066

--- Comment #4 from paul.richard.thomas at gmail dot com  ---
Hi Steve,

Indeed - I found that paragraph shortly after writing. Thanks for posting
it.

Cheers

Paul


On Thu, 9 Mar 2023 at 15:33, kargl at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066
>
> kargl at gcc dot gnu.org changed:
>
>What|Removed |Added
>
> 
>  CC||kargl at gcc dot gnu.org
>
> --- Comment #3 from kargl at gcc dot gnu.org ---
> (In reply to Paul Thomas from comment #2)
> > Hi Andrew,
> >
> > Thanks for the report. However, IMHO the code is invalid since the
> result of
> > hdf5Constructor is not defined.
> >
> >   function hdf5Constructor() result(self)
> > implicit none
> > type(hdf5Object) :: self
> > self = hdf5Object (resourceManager())
> > return
> >   end function hdf5Constructor
> >
> > works a treat.
> >
> > If there is a requirement in the standard that a function result such as
> > this be initialised, I am unable to find it in the F2018 standard.
> >
> > Paul
>
> F2018, page 319.
> If the function result is not a pointer, its value shall be defined by
> the function.  If the function result is a pointer, on return the pointer
> association status of the function result shall not be undefined.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

[Bug fortran/109066] Segfault when using defined assignment

2023-03-09 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #2)
> Hi Andrew,
> 
> Thanks for the report. However, IMHO the code is invalid since the result of
> hdf5Constructor is not defined.
> 
>   function hdf5Constructor() result(self)
> implicit none
> type(hdf5Object) :: self
> self = hdf5Object (resourceManager())
> return
>   end function hdf5Constructor
> 
> works a treat.
> 
> If there is a requirement in the standard that a function result such as
> this be initialised, I am unable to find it in the F2018 standard. 
> 
> Paul

F2018, page 319.
If the function result is not a pointer, its value shall be defined by
the function.  If the function result is a pointer, on return the pointer
association status of the function result shall not be undefined.

[Bug fortran/109066] Segfault when using defined assignment

2023-03-09 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066

--- Comment #2 from Paul Thomas  ---
Hi Andrew,

Thanks for the report. However, IMHO the code is invalid since the result of
hdf5Constructor is not defined.

  function hdf5Constructor() result(self)
implicit none
type(hdf5Object) :: self
self = hdf5Object (resourceManager())
return
  end function hdf5Constructor

works a treat.

If there is a requirement in the standard that a function result such as this
be initialised, I am unable to find it in the F2018 standard. 

Paul

[Bug fortran/109066] Segfault when using defined assignment

2023-03-09 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109066

Paul Thomas  changed:

   What|Removed |Added

   Last reconfirmed||2023-03-09
 CC||pault at gcc dot gnu.org
 Status|UNCONFIRMED |NEW
Version|unknown |13.0
 Ever confirmed|0   |1

--- Comment #1 from Paul Thomas  ---
8.3.1 20191027 runs through to the end of the program and then segfaults.

9.2.1 20191221 shows the same behaviour as mainline, as do all the branches in
between.

Thanks for the report

Paul