[Bug fortran/77525] wrong requirement of an upper bound for an array argument

2021-12-21 Thread themos.tsikas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77525

Themos Tsikas  changed:

   What|Removed |Added

 CC||themos.tsikas at gmail dot com

--- Comment #3 from Themos Tsikas  ---
For the benefit of others which encounter this bug, a workaround is presented
below:

 Module mdb_proc
  Implicit None
  Abstract Interface
Subroutine p(tx, r)
  Real, Intent (In) :: tx(*)
  Real, Intent (Out) :: r
End Subroutine
  End Interface

  Type mdb_proc_t
Character (32) :: cname
Integer :: mode = 0
Procedure (p), Pointer, Nopass :: f
  End Type

  Integer, Parameter :: nprocmax = 2
  Type (mdb_proc_t), Target :: listproc(1:nprocmax)

End Module

Subroutine test(tx, r)
  Use mdb_proc, Only: mdb_proc_t, listproc, p
  Implicit None
  Real, Intent (In) :: tx(*)
  Real, Intent (Out) :: r
  Type (mdb_proc_t), Pointer :: my_proc

  my_proc => listproc(1)
! Call my_proc%f(tx,r)
  Call workaround(pp=my_proc%f, tx=tx, r=r)
  Print '(EN12.3)', r
Contains
  Subroutine workaround(pp, tx, r)
Procedure (p) :: pp
Real, Intent (In) :: tx(*)
Real, Intent (Out) :: r

Call pp(tx, r)
  End Subroutine
End Subroutine

Program main
  Use mdb_proc, Only:mdb_proc_t, listproc

  Real, Allocatable :: z(:)
  Integer :: nz

  listproc(1) = mdb_proc_t('a', 1, p1)

  Allocate (z(0))
  nz = 0
  Call test(z, r)
  Deallocate (z)
  Allocate (z(1))
  z = 42.
  nz = 1
  Call test(z, r)
Contains
  Subroutine p1(tx, r)
Real, Intent (In) :: tx(*)
Real, Intent (Out) :: r

r = maxval(tx(1:nz))
  End Subroutine
End Program

[Bug fortran/77525] wrong requirement of an upper bound for an array argument

2016-09-09 Thread francois.jacq at irsn dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77525

--- Comment #2 from francois.jacq at irsn dot fr ---
(In reply to Dominique d'Humieres from comment #1)
> Confirmed from 4.5 up to trunk (7.0). Fortran 2003: Procedure components at
> (1) are not yet implemented in gfortran-4.4.
> 
> > This is a regression because gfortran 4.9.2 is OK
> 
> Are you sure of that? I don't have 4.9.2, but I see the error with various
> 4.9.0 and 4.9.4.

No you are right ! It does not work even with gfortran-4.9.2

Sorry for that wrong remark...

[Bug fortran/77525] wrong requirement of an upper bound for an array argument

2016-09-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77525

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-08
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed from 4.5 up to trunk (7.0). Fortran 2003: Procedure components at (1)
are not yet implemented in gfortran-4.4.

> This is a regression because gfortran 4.9.2 is OK

Are you sure of that? I don't have 4.9.2, but I see the error with various
4.9.0 and 4.9.4.