Skip to content

v crash on OpenBSD with code sent from stdin #26361

@lcheylus

Description

@lcheylus

Describe the bug

On OpenBSD/amd64, when trying to run V code sent via stdin, v compilation fails with panic.

Reproduction Steps

  • Build V from sources on OpenBSD/amd64 via gmake rebuild (GNU make)
  • Try to run a simple V code sent from stdin: echo "println(2+5)" | ./v run -

Expected Behavior

No error when running V code sent from stdin => V code compiles and runs as expected.

OK on Linux Debian/amd64

$ echo "println(2+5)" | ./v run -
7

Current Behavior

Crash/Panic on OpenBSD/amd64:

$ echo "println(2+5)" | ./v run -
V panic: tos(): nil string
 v hash: 0e4ae76
    pid: 0x10fe9
    tid: 0x2f263da70
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:22255: at builtin___v_panic: Backtrace
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:22562: by builtin__tos
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:27218: by os__get_raw_line
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:27777: by os__get_raw_lines
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:27786: by os__get_raw_lines_joined
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:32116: by v__pref__parse_args_and_show_errors
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:63204: by main__main
/tmp/v_1000/v.01KF0H62NX48N498NN007C258H.tmp.c:64280: by main

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.5.0 0e4ae76

Environment details (OS name and version, etc.)

V full version V 0.5.0 0e4ae76
OS openbsd, 7.8, GENERIC.MP#192
Processor 4 cpus, 64bit, little endian
Memory 1.41GB/3.98GB
V executable /home/fox/dev/vlang.git/v
V last modified time 2026-01-15 09:53:33
V home dir OK, value: /home/fox/dev/vlang.git
VMODULES OK, value: /home/fox/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/fox/dev/vlang.git
Git version git version 2.52.0
V git status weekly.2026.03-20-g0e4ae765
.git/config present true
cc version OpenBSD clang version 19.1.7
gcc version egcc (GCC) 11.2.0
clang version OpenBSD clang version 19.1.7
tcc version tcc version 0.9.28rc 2025-05-27 HEAD@cb39bc4c (x86_64 OpenBSD)
tcc git status thirdparty-openbsd-amd64 200e7752
emcc version N/A
glibc version N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions