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

            Bug ID: 87127
           Summary: External function not recognised from within an
                    associate block
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

Posted on:
https://groups.google.com/forum/#!topic/comp.lang.fortran/Jc_3vZeATdU

function exfunc(i)
implicit none
integer :: exfunc,i
exfunc = 2*i
end function

! contents of test.f90
program test
implicit none
integer :: exfunc,i
integer,parameter :: array(2)=[6,7]
associate(i=>array(1))
write(*,*) exfunc(i)
end associate
end program 

produces

 write(*,*) exfunc(i)
          1
Error: ‘exfunc’ at (1) is not a function

Removing the associate block, invoking 'exfunc' outside it or declaring it
explicitly to be a function all remove the error.

Other brands compile the testcase without error.

At first glance, it seems that resolution of symbols in the main program is
occurring without taking the associate block into account and that this is
resolved afterwards.

Reply via email to