[Bug fortran/125383] [14/15/16/17 Regression] Optional dummy procedure called from contained subprogram results in linking error since r16-3178 / r14-12039
albert at tugraz dot at via Gcc-bugs <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125383
Christopher Albert <albert at tugraz dot at> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |albert at tugraz dot at
--- Comment #10 from Christopher Albert <albert at tugraz dot at> ---
Open for review, comments welcome:
https://github.com/lazy-fortran/gcc/pull/41
Root cause: a CALL statement marks an unresolved procedure as a
subroutine before its procedure kind is known, and was_declared in
resolve.cc treated that provisional attribute as a declaration, so
resolution never reached the optional dummy procedure in the host
scope and emitted an undefined local symbol instead. The fix makes
was_declared require a known procedure kind before the subroutine
attribute counts as a declaration (one condition). A run test is
included; check-fortran and the libgomp Fortran suite are clean.