Skip to content

Open file closes when passed to an impure funtion #1229

@Galactic-Explorer

Description

@Galactic-Explorer

When passing an open file to an impure function and trying to read a line of it, the following fail message comes up:

$ nvc -a pkg.vhd test.vhd -e test -r
** Fatal: (init): ENDFILE called on closed file
   Function F1 [TEXT return STRING] at C:\...\pkg.vhd:41
   Function F1 [STRING return STRING] at C:\...\pkg.vhd:22
   Process (init) at C:\...\test.vhd:13
$ nvc -v
nvc 1.16.1 (1.16.1.r0.ge2307876) (Using LLVM 20.1.3)
Copyright (C) 2011-2025  Nick Gasson
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and
you are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.

Reproducables;

The same error shows up if the 2 functions were no overloads of one another.

pkg.txt

test.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions