pgfortran confused by CONTAINS

pgfortran 17.10 appears not to support Fortran 2008’s empty contains, but the Fortran 2003 program

contains
  subroutine s
  end
end

results in an ICE. The Fortran 2008 version without the subroutine also gives a misleading rejection message:

PGF90-S-0155-Internal subprograms may not be nested

Further, for the invalid source

program
contains
end

the compiler reports the syntax error, but the compiler process does not return (on my system).

I have reported three problems within TPR 25124

  1. Fails with a CONTAINS not in a container
  2. Fails with a CONTAINS with no contents
  3. Hangs when ‘program’ statement lacks a program name.

The second example hung because there was no program name,
and it failed in the CONTAINs area when we added a name.

dave

Issue is fixed with 19.7 and above.