[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-29 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #36 from Jürgen Reuter  ---
I can confirm that the push by Paul, 297363774e6a5dca2f46a85ab086f1d9e59431ac,
does fix all compilations and tests in our code and test suite.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #35 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:297363774e6a5dca2f46a85ab086f1d9e59431ac

commit r11-7880-g297363774e6a5dca2f46a85ab086f1d9e59431ac
Author: Paul Thomas 
Date:   Sun Mar 28 16:48:27 2021 +0100

Fortran: Fix problem with runtime pointer check [PR99602].

2021-03-28  Paul Thomas  

gcc/fortran/ChangeLog

PR fortran/99602
* trans-expr.c (gfc_conv_procedure_call): Use the _data attrs
for class expressions and detect proc pointer evaluations by
the non-null actual argument list.

gcc/testsuite/ChangeLog

PR fortran/99602
* gfortran.dg/pr99602.f90: New test.
* gfortran.dg/pr99602a.f90: New test.
* gfortran.dg/pr99602b.f90: New test.
* gfortran.dg/pr99602c.f90: New test.
* gfortran.dg/pr99602d.f90: New test.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-24 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #34 from Jürgen Reuter  ---
(In reply to Paul Thomas from comment #33)
> (In reply to Jürgen Reuter from comment #32)
> > Ready for merge?
> 
> Hi Juergen,
> 
> Daytime work intervened. I will submit to the list today.
> 

Great!


> Thanks for all your support BTW.
> 

On the contrary, thanks for your continuous great support!

> Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-24 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #33 from Paul Thomas  ---
(In reply to Jürgen Reuter from comment #32)
> Ready for merge?

Hi Juergen,

Daytime work intervened. I will submit to the list today.

Thanks for all your support BTW.

Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-23 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #32 from Jürgen Reuter  ---
Ready for merge?

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-21 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #31 from Jürgen Reuter  ---
(In reply to Paul Thomas from comment #30)
> Created attachment 50442 [details]
> Patch that "fixes" all versions of the problem.. so far :-)
> 
> Hi Juergen,
> 
> I think that this one does the job... it is even correct and regtests OK;-)
> 
> I found that the gdb session was a miserable afair that didn't help at all
> because of the change in dwarf versions. I would up reducing the testcase to
> what you will find below. Please excuse my mutilation of Whizard!
> 
> The chunk of whizard that you provided throws up all sorts of memories. In
> the 1970's I used to go up to Caltech every Wednesday for Feynman and
> Gell-mann seminars. I was around for the earliest days of partons and the
> realisation that quarks might even be real.
> 
> Paul
> 

Hi Paul,
that's a much nicer reproducer, congrats! And thanks for fixing this regression
so timely. I confirm that all our tests work again with this fix. I guess the
compilation and running with default flags (-g -O2) is not affected by this
fix? But I will test once the fix is committed. 
Nice to hear that you had such a fun time at Calteach. I was never there
unfortunately, but visited Stanford U. and SLAC a lot. And I was lucky to meet
Gell-Mann as well, 2008 in Aspen at the physics center. 
To me the fix looks good to go, when it is pushed I will recompile gcc and run
our code with all different combinations again.
All the best,
   JRR

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-21 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #30 from Paul Thomas  ---
Created attachment 50442
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50442=edit
Patch that "fixes" all versions of the problem.. so far :-)

Hi Juergen,

I think that this one does the job... it is even correct and regtests OK;-)

I found that the gdb session was a miserable afair that didn't help at all
because of the change in dwarf versions. I would up reducing the testcase to
what you will find below. Please excuse my mutilation of Whizard!

The chunk of whizard that you provided throws up all sorts of memories. In the
1970's I used to go up to Caltech every Wednesday for Feynman and Gell-mann
seminars. I was around for the earliest days of partons and the realisation
that quarks might even be real.

Paul

module model_data
  type :: model_data_t
 type(modelpar_real_t), dimension(:), pointer :: par_real => null ()
   contains
 procedure :: get_par_data_ptr => model_data_get_par_data_ptr_name
 procedure :: set => field_data_set
  end type model_data_t

  type :: modelpar_real_t
 character (4) :: name
 real(4) :: value
  end type modelpar_real_t

  type(modelpar_real_t), target :: names(2) = [modelpar_real_t("foo ", 1), &
   modelpar_real_t("bar ", 2)]

contains

  function model_data_get_par_data_ptr_name (model, name) result (ptr)
class(model_data_t), intent(in) :: model
character (*), intent(in) :: name
class(modelpar_real_t), pointer :: ptr
integer :: i
ptr => null ()
do i = 1, size (model%par_real)
   if (model%par_real(i)%name == name) ptr => model%par_real(i)
end do
  end function model_data_get_par_data_ptr_name

  subroutine field_data_set (this, ptr)
class(model_data_t), intent(inout) :: this
class(modelpar_real_t), intent(in), pointer :: ptr
if (associated (ptr)) then
  print *, "'ptr%value' = ", ptr%value
else
  print *, "'ptr' not associated in 'field_data_set'"
end if
  end subroutine

end module model_data

  use model_data
  class(model_data_t), allocatable :: model
  class(modelpar_real_t), pointer :: name_ptr

  allocate (model_data_t :: model)
  model%par_real => names

!  name_ptr => model%get_par_data_ptr ("bar ")
!  call field_data_set (model, name_ptr)
!  call field_data_set (model, model%get_par_data_ptr ("bar "))
  call model%set (model%get_par_data_ptr ("bar "))
  call model%set (model%get_par_data_ptr ("tea "))
end

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-19 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #29 from Jürgen Reuter  ---
(In reply to Paul Thomas from comment #28)
> (In reply to Jürgen Reuter from comment #27)
> > Created attachment 50432 [details]
> > reproducer, down to 6800 lines
> 
> Hi Juergen,
> 
> Stop! Yesterday's final is just fine. The problem is connected with the
> logic selecting the runtime error. The code for line 483 ends with
> 
>   D.5856 = model->_vptr->get_par_data_ptr (,
> D.5855);
>   if ((character(kind=1)[0:][1:1] * restrict)
> D.5855->chars.data != 0B)
> {
>   __builtin_free ((void *) D.5855->chars.data);
>   (character(kind=1)[0:][1:1] * restrict)
> D.5855->chars.data = 0B;
> }
>   if ((integer(kind=8)) (D.5856._data == 0B))
> {
>   _gfortran_runtime_error_at (&"At line 483 of file
> models.f90"[1]{lb: 1 sz: 1}, &"Proc-pointer actual argument \'model\' is not
> associated"[1]{lb: 1 sz: 1});
> }
>   field_data_set (, 0B, 0B, 0B, 0B, 0B, 0B,
> 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, ,
> 0B, 0B, 0B);
> }
> 
> The _data field of D.5856 is the result of the call to 'get_par_data_ptr'
> not the procedure pointer itself. The result is:
> class(modelpar_data_t), pointer :: ptr and the formal argument is:
> class(modelpar_data_t), intent(in), pointer, optional :: mass_data
> 
> So the call is perfectly proper. The trouble is that the attributes of the
> proc_pointer result are not being used.
> 
> I am about to start a gdb session :-)
> 
> Paul

Cool, very good, I'm never really sure which max. size a reproducer is still
useful for you. Then I stop reducing further now.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-19 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #28 from Paul Thomas  ---
(In reply to Jürgen Reuter from comment #27)
> Created attachment 50432 [details]
> reproducer, down to 6800 lines

Hi Juergen,

Stop! Yesterday's final is just fine. The problem is connected with the logic
selecting the runtime error. The code for line 483 ends with

  D.5856 = model->_vptr->get_par_data_ptr (,
D.5855);
  if ((character(kind=1)[0:][1:1] * restrict)
D.5855->chars.data != 0B)
{
  __builtin_free ((void *) D.5855->chars.data);
  (character(kind=1)[0:][1:1] * restrict)
D.5855->chars.data = 0B;
}
  if ((integer(kind=8)) (D.5856._data == 0B))
{
  _gfortran_runtime_error_at (&"At line 483 of file
models.f90"[1]{lb: 1 sz: 1}, &"Proc-pointer actual argument \'model\' is not
associated"[1]{lb: 1 sz: 1});
}
  field_data_set (, 0B, 0B, 0B, 0B, 0B, 0B, 0B,
0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, 0B, , 0B,
0B, 0B);
}

The _data field of D.5856 is the result of the call to 'get_par_data_ptr' not
the procedure pointer itself. The result is:
class(modelpar_data_t), pointer :: ptr and the formal argument is:
class(modelpar_data_t), intent(in), pointer, optional :: mass_data

So the call is perfectly proper. The trouble is that the attributes of the
proc_pointer result are not being used.

I am about to start a gdb session :-)

Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-19 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #27 from Jürgen Reuter  ---
Created attachment 50432
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50432=edit
down to 6800 lines

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-19 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #26 from Jürgen Reuter  ---
Created attachment 50431
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50431=edit
Single file reproducer, 7505 lines, no input files any more

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #25 from Jürgen Reuter  ---
Created attachment 50430
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50430=edit
reproducer for another model pointer, final for 2021-03-19-03:22

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #24 from Jürgen Reuter  ---
Please have a look at my final reproducer. Is that feasible?

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #23 from Jürgen Reuter  ---
Created attachment 50429
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50429=edit
first ok-ish reproducer

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #22 from Jürgen Reuter  ---
Created attachment 50428
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50428=edit
bit smaller reproducer, not yet ideal

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #21 from Jürgen Reuter  ---
Created attachment 50427
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50427=edit
remaing false positive detection (long test)

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-18 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #20 from Jürgen Reuter  ---
Looks like there is still one more case. One of our unit tests is still failing
with this patch. I will report more soon.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

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

--- Comment #17 from paul.richard.thomas at gmail dot com  ---
Good morning all,

I have attached the revised patch and an additional testcase. I had totally
forgotten about the class pointer gotcha.

OK for master?

Paul

Fortran: Fix runtime errors for class actual arguments [PR99602].

2021-03-18  Paul Thomas  

gcc/fortran
PR fortran/99602
* trans-array.c (gfc_conv_procedure_call): For class formal
arguments, use the _data field attributes for runtime errors.
For class expressions use the class_pointer attribute.

gcc/testsuite/
PR fortran/99602
* gfortran.dg/pr99602.f90: New test.
* gfortran.dg/pr99602a.f90: New test.


On Wed, 17 Mar 2021 at 17:57, anlauf at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602
>
> --- Comment #16 from anlauf at gcc dot gnu.org ---
> (In reply to Jürgen Reuter from comment #15)
> > > LGTM.  It's by Paul.  He simply needs to get the testcase's dg-foo
> right...
> > > ;-)
> >
> > Now I'm confused. So you consider the fix ok? Will it then be committed?
>
> The fix was basically OKed on the fortran ML by Tobias, he only wondered
> if there should be a runtime test.  One could simply change the line
>
> ! { dg-do compile }
>
> to
>
> ! { dg-do run }
>
> before committing.  Still confused?
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
> You are on the CC list for the bug.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-17 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #16 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #15)
> > LGTM.  It's by Paul.  He simply needs to get the testcase's dg-foo right...
> > ;-)
> 
> Now I'm confused. So you consider the fix ok? Will it then be committed?

The fix was basically OKed on the fortran ML by Tobias, he only wondered
if there should be a runtime test.  One could simply change the line

! { dg-do compile }

to

! { dg-do run }

before committing.  Still confused?

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-17 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #15 from Jürgen Reuter  ---
(In reply to anlauf from comment #14)
> (In reply to Jürgen Reuter from comment #13)
> > Cool, thanks for the quick reaction, Paul. Maybe Harald can have a look at
> > it as well :D
> 
> LGTM.  It's by Paul.  He simply needs to get the testcase's dg-foo right...
> ;-)

Now I'm confused. So you consider the fix ok? Will it then be committed?

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #14 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #13)
> Cool, thanks for the quick reaction, Paul. Maybe Harald can have a look at
> it as well :D

LGTM.  It's by Paul.  He simply needs to get the testcase's dg-foo right... ;-)

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Jürgen Reuter  changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #13 from Jürgen Reuter  ---
Cool, thanks for the quick reaction, Paul. Maybe Harald can have a look at it
as well :D

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Paul Thomas  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #12 from Paul Thomas  ---
Created attachment 50397
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50397=edit
Fix for the PR

This regtests OK.

The problem seems to have been caused by the fix for PR99112.

Cheers

Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Paul Thomas  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-03-16
 Ever confirmed|0   |1

--- Comment #11 from Paul Thomas  ---
I took my build directory down to bedrock and recompiled. I see the problem
now. I'm onto it :-)

Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #10 from Jürgen Reuter  ---
(In reply to Jürgen Reuter from comment #9)
> (In reply to Paul Thomas from comment #8)
> 
> > 
> > Paul
> 
> $ gfortran -fcheck=pointer repro.f90
> reuter@Manwe:~/local/packages/whizard/trunk/_build_flags/RT_20210315$
> ./a.out 
> At line 38 of file repro.f90
> Fortran runtime error: Pointer actual argument 'mm' is not associated
> 
> Error termination. Backtrace:
> #0  0x106ff6fde
> #1  0x106ff7c85
> #2  0x106ff8256
> #3  0x106fe5a9d
> #4  0x106fe5c8b
> #5  0x106fe5cc6

So if I understand this correctly then gfortran does a false positive, it
wrongly flags status of the pointer mm as non-associated and exits with a
run-time error. gfortran before didn't do this, and also nagfor with -C=all
doesn't flag this.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #9 from Jürgen Reuter  ---
(In reply to Paul Thomas from comment #8)

> 
> Paul

$ gfortran -fcheck=pointer repro.f90
reuter@Manwe:~/local/packages/whizard/trunk/_build_flags/RT_20210315$ ./a.out 
At line 38 of file repro.f90
Fortran runtime error: Pointer actual argument 'mm' is not associated

Error termination. Backtrace:
#0  0x106ff6fde
#1  0x106ff7c85
#2  0x106ff8256
#3  0x106fe5a9d
#4  0x106fe5c8b
#5  0x106fe5cc6

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #8 from Paul Thomas  ---
(In reply to Jürgen Reuter from comment #6)
> Actually, the last example missed a line that I overeagerly deleted too
> much. This one is the correct reproducer:
> module m
>   implicit none
>   private
>   public :: m_t
>   type :: m_t
>  private
>   end type m_t
> end module m
> 
> module m2_testbed
>   use m
>   implicit none
>   private
>   public :: prepare_m2
>   procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()
> 
>   abstract interface
>  subroutine prepare_m2_proc (m2)
>import
>class(m_t), intent(inout), pointer :: m2
>  end subroutine prepare_m2_proc
>   end interface
> 
> end module m2_testbed
> 
> module a
>   use m
>   use m2_testbed, only: prepare_m2
>   implicit none
>   private
>   public :: a_1
> 
> contains
> 
>   subroutine a_1 ()
> class(m_t), pointer :: mm
> mm => null ()
> call prepare_m2 (mm)
>   end subroutine a_1
> 
> end module a
> 
> 
> module m2
>   use m
>   implicit none
>   private
>   public :: m2_t
>   
>   type, extends (m_t) :: m2_t
>  private
>contains
>  procedure :: read => m2_read
>   end type m2_t
> contains
> 
>   subroutine m2_read (mm)
> class(m2_t), intent(out), target :: mm
>   end subroutine m2_read
> end module m2
> 
> program main
>   use m2_testbed
>   use a, only: a_1
>   implicit none
>   prepare_m2 => prepare_whizard_m2
>   call a_1 ()
>   
> contains
> 
>   subroutine prepare_whizard_m2 (mm)
> use m
> use m2
> class(m_t), intent(inout), pointer :: mm
> if (.not. associated (mm))  allocate (m2_t :: mm)
> select type (mm)
> type is (m2_t)
>call mm%read ()
> end select
>   end subroutine prepare_whizard_m2
> end program main

Hi Juergen,

I still cannot reproduce the problem. In fact, the runtime error message does
not appear in the tree dump.

Best regards

Paul

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4
   Target Milestone|--- |11.0

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #7 from Jürgen Reuter  ---
(In reply to Jürgen Reuter from comment #3)
> Here is a shorter reproducer, and this time it is the -fcheck=pointer that
> leads to the problem. I was able to reproduce this to 80 lines, leading to
> the error:
> At line 41 of file repro.f90
> Fortran runtime error: Pointer actual argument 'm2' is not associated
> 
> module m
m2
> end program main

Please consider the follow-up comment with the corrected example, Comment #6.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #6 from Jürgen Reuter  ---
Actually, the last example missed a line that I overeagerly deleted too much.
This one is the correct reproducer:
module m
  implicit none
  private
  public :: m_t
  type :: m_t
 private
  end type m_t
end module m

module m2_testbed
  use m
  implicit none
  private
  public :: prepare_m2
  procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()

  abstract interface
 subroutine prepare_m2_proc (m2)
   import
   class(m_t), intent(inout), pointer :: m2
 end subroutine prepare_m2_proc
  end interface

end module m2_testbed

module a
  use m
  use m2_testbed, only: prepare_m2
  implicit none
  private
  public :: a_1

contains

  subroutine a_1 ()
class(m_t), pointer :: mm
mm => null ()
call prepare_m2 (mm)
  end subroutine a_1

end module a


module m2
  use m
  implicit none
  private
  public :: m2_t

  type, extends (m_t) :: m2_t
 private
   contains
 procedure :: read => m2_read
  end type m2_t
contains

  subroutine m2_read (mm)
class(m2_t), intent(out), target :: mm
  end subroutine m2_read
end module m2

program main
  use m2_testbed
  use a, only: a_1
  implicit none
  prepare_m2 => prepare_whizard_m2
  call a_1 ()

contains

  subroutine prepare_whizard_m2 (mm)
use m
use m2
class(m_t), intent(inout), pointer :: mm
if (.not. associated (mm))  allocate (m2_t :: mm)
select type (mm)
type is (m2_t)
   call mm%read ()
end select
  end subroutine prepare_whizard_m2
end program main

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #5 from Jürgen Reuter  ---
Created attachment 50393
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50393=edit
New short reproducer, this time consistent

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-16 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Jürgen Reuter  changed:

   What|Removed |Added

  Attachment #50391|0   |1
is obsolete||

--- Comment #4 from Jürgen Reuter  ---
Comment on attachment 50391
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50391
Short reproducer

THere is a missing line, please consider next example.

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-15 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

Jürgen Reuter  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org

--- Comment #3 from Jürgen Reuter  ---
Here is a shorter reproducer, and this time it is the -fcheck=pointer that
leads to the problem. I was able to reproduce this to 80 lines, leading to the
error:
At line 41 of file repro.f90
Fortran runtime error: Pointer actual argument 'm2' is not associated

module m
  implicit none
  private
  public :: m_t
  type :: m_t
 private
  end type m_t
end module m

module m2_testbed
  use m
  implicit none
  private
  public :: prepare_m2
  procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()

  abstract interface
 subroutine prepare_m2_proc (m2)
   import
   class(m_t), intent(inout), pointer :: m2
 end subroutine prepare_m2_proc
  end interface

end module m2_testbed

module a
  use m
  use m2_testbed, only: prepare_m2
  implicit none
  private
  public :: a_1

contains

  subroutine a_1 ()
class(m_t), pointer :: m2
m2 => null ()
call prepare_m2 (m2)
  end subroutine a_1

end module a


module m2
  use m
  implicit none
  private
  public :: m2_t

  type, extends (m_t) :: m2_t
 private
   contains
 procedure :: read => m2_read
  end type m2_t
contains

  subroutine m2_read (m2)
class(m2_t), intent(out), target :: m2
  end subroutine m2_read
end module m2

program main
  use m2_testbed
  use a, only: a_1
  implicit none
  prepare_m2 => prepare_whizard_m2
  call a_1 ()

contains

  subroutine prepare_whizard_m2 (m2)
use m
use m2
class(m_t), intent(inout), pointer :: m2
select type (m2)
type is (m2_t)
   call m2%read ()
end select
  end subroutine prepare_whizard_m2
end program main

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-15 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #2 from Jürgen Reuter  ---
Created attachment 50391
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50391=edit
Short reproducer

[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

2021-03-15 Thread juergen.reuter at desy dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99602

--- Comment #1 from Jürgen Reuter  ---
Created attachment 50389
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50389=edit
First (large) reproducer to play with, reducing atm