NVFORTRAN reports "Internal compiler error. Errors in ILM file" when its temporary files cannot be written (full TMPDIR)

Hello,

When TMPDIR fills up during compilation, NVFORTRAN 26.9 can fail with an internal compiler error. The real cause, a failed write to a temporary file, is not reported:

NVFORTRAN-F-0000-Internal compiler error. Errors in ILM file      52  (.../test_extrap_mpi.f90)

The Fortran front end (fort1) does not seem to check for write errors on its temporary ILM file (and .stb file). It exits with status 0 even when those files are truncated. The back end (fort2) then fails to parse the truncated ILM file and reports an internal compiler error. The source code is fine: the same file compiles once there is space in TMPDIR. A user who hits the full-disk case may take this as a code-generation bug (as we did at first).

Environment

  • NVIDIA HPC SDK 26.9
  • nvfortran 26.9-0 64-bit target on x86-64 Linux -tp cascadelake
  • Ubuntu 26.04.1 LTS, x86-64

How we hit it

We ran several builds in parallel with the default TMPDIR=/tmp. On this machine, /tmp is a tmpfs with per-user quotas (usrquota). Once the quota was reached:

  • one nvfortran -acc -cuda ... compilation failed with the internal compiler error above;
  • in the same build, the assembler reported the real cause correctly:
/tmp/nvddNui5i1gOKl32Q.s: Fatal error: can't write 3912 bytes to section .nv_fatbin of /tmp/pgcudafatboi5idCFdHvol.o: 'Disk quota exceeded'

After pointing TMPDIR at a file system with free space, the same source compiles without errors.

MRE

The reproducer below instead uses a per-process file-size limit (ulimit -f), which makes write(2) on the temporary files fail with EFBIG, the same way it fails with ENOSPC/EDQUOT on a full disk. SIGXFSZ is ignored so that the compiler sees the failed write instead of being killed.

Save as hello.f90:

program hello
  implicit none
  real :: a(100)
  integer :: i
  a = [(real(i), i=1,100)]
  print *, sum(a)
end program hello

Run:

nvfortran -c hello.f90                                     # control: compiles fine
bash -c "trap '' XFSZ; ulimit -f 4; nvfortran -c hello.f90"  # writes beyond 4 KiB fail

The compilation fails with exit status 2. About 50 lines like

ILM file line 45: expecting bit ptrsafe
instead got:

are followed by

NVFORTRAN-F-0000-Internal compiler error. Errors in ILM file      53  (hello.f90)

Other limits produce other misleading messages, also without an I/O error:

  • With ulimit -f 2, the only hint is a non-fatal message from the front end:

    lower_ilm_finish - fseek on lower_ilm_file: File too large
    NVFORTRAN-F-0000-Internal compiler error. Errors in ILM file      21  (hello.f90)
    
  • With ulimit -f 8:

    IILM file version error
    Expecting DIRECTIVES version 1/69
          got  version 0/0
    

Expected result and controls

We expect a diagnostic that names the I/O failure and the temporary file, as NVFORTRAN already does for its “state file” in the same situation. With an internal procedure, for example in internal.f90:

program internal
  implicit none
  call s()
contains
  subroutine s()
    print *, 'hello'
  end subroutine s
end program internal

the same command

bash -c "trap '' XFSZ; ulimit -f 4; nvfortran -c internal.f90"

reports the error correctly:

NVFORTRAN-F-0010-File write error occurred (state file) (internal.f90)
NVFORTRAN/x86-64 Linux 26.9-0: compilation aborted

So it seems that only the writes to the ILM (and .stb) files go unchecked.

Thanks in advance for looking into this!

Pedro

AI Disclaimer: Post drafted with the help of Claude Code.

Hi Pedro, and thanks for the report.

I was able to recreate it here and filed TPR #39124. We’ll have engineering see if they can catch the problem and issue a better error message.

-Mat