https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110350
Bug ID: 110350
Summary: Intrinsic handling inside nested associate blocks
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: rimvydas.jas at gmail dot com
Target Milestone: ---
$ cat test_iargc.f90
program foo
implicit none
integer :: iargc
integer :: z
associate(x=>z)
associate(y=>z)
if(iargc().lt.5) stop 5
end associate
end associate
end program
$ gfortran -Wall -Wextra test_iargc.f90
test_iargc.f90:8:6:
8 | if(iargc().lt.5) stop 5
| 1
Error: 'iargc' at (1) is not a function
Seems behavior almost the same down to gfortran-4.8
Removing single nested unrelated associate block results in undefined reference
to iargc_()
Removing optional 'integer :: iargc' kind declaration works.