https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109209

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-20

--- Comment #11 from Paul Thomas <pault at gcc dot gnu.org> ---

> Thanks for checking, Tobias. Are you saying that the code violates the
> standard, or the code generation after parsing by gcc/gfortran has generated
> code violating the standard?

Hi Jürgen,

Its' the latter - see the end of this reply.

Other brands don't like your reproducer:

[pault@pc30 pr37336]$ rm ./a.out;nagfor pr109209.f90 -g;./a.out
rm: cannot remove './a.out': No such file or directory
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7115
Error: pr109209.f90, line 63: Type-bound procedure T3_SET_EXPAND must be a
module procedure or external procedure with an explicit interface
       detected at T3_SET_EXPAND@(
Error: pr109209.f90, line 73: Undefined type-bound procedure T3_SET_EXPAND
[NAG Fortran Compiler pass 1 error termination, 2 errors]


[pault@pc30 pr37336]$ rm ./a.out;ifort pr109209.f90 -g;./a.out
rm: cannot remove './a.out': No such file or directory
pr109209.f90(63): error #6115: A separate interface body must have been
declared in the program unit or an ancestor of the program unit for the
separate module procedure.   [T3_SET_EXPAND]
  module subroutine t3_set_expand (res_set)
--------------------^
pr109209.f90(64): error #6451: A dummy argument name is required in this
context.   [RES_SET]
    class(t3_set_t), intent(inout) :: res_set
--------------------------------------^
pr109209.f90(38): error #8169: The specified interface is not declared.  
[T3_SET_EXPAND]
     procedure, private :: expand => t3_set_expand
-------------------------------------^
compilation aborted for pr109209.f90 (code 1)

both compile it just fine if you
s/module subroutine t3_set_expand/subroutine t3_set_expand/


Removing Harald's commit, commit 901edd99b44976b3c2b13a7d525d9e315540186a,
doesn't do the job.

However, removing my patch for pr37336 does indeed allow the code to compile as
before.

Everybody is happy with
  subroutine t3_set_expand (res_set)
    class(t3_set_t), intent(inout) :: res_set
    type(t3_t), dimension(:), allocatable :: history_new
    integer :: s, i
    s = size (res_set%history)
    allocate (history_new (2 * s))
    do i = 1,s
      history_new(i) = res_set%history(i)
    end do
    call move_alloc (history_new, res_set%history)
  end subroutine t3_set_expand

Actually, I think that I have indeed introduced a bug since t3_t has a defined
assignment.

Give me 30 minutes:-)

Paul

Reply via email to