Skip to content

With asm ".warning \"\"\n.warning \"\"\n.warning \"\"\n.warning \"\"\n" Nim --lineDir:on can generate out-of-bounds line numbers #25923

Description

@tersec

Nim Version

Nim Compiler Version 2.2.10 [Linux: amd64]
Compiled at 2026-06-18
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: bfeb3146d1638b39f69007a4ae5a23e23ae4e5ef
active boot switches: -d:release
Nim Compiler Version 2.2.11 [Linux: amd64]
Compiled at 2026-06-18
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: 7b57dc1e54d2af08b12f995bb76cd44d663b3537
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2026-06-18
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: f8e470eb579c96515693d76ad393dbd41b393f26
active boot switches: -d:release
gcc (Debian 15.3.0-1) 15.3.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Description

proc f() =
  asm ".warning \"\"\n.warning \"\"\n.warning \"\"\n.warning \"\"\n"
f()

Current Output

CC: system/exceptions.nim
CC: std/private/digitsutils.nim
CC: system/dollars.nim
CC: system.nim
CC: d.nim
Hint:  [Link]
/tmp/ccmP2nnC.s: Assembler messages:
/tmp/d.nim:2: Warning: 
/tmp/d.nim:3: Warning: 
/tmp/d.nim:4: Warning: 
/tmp/d.nim:5: Warning: 
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
29751 lines; 0.587s; 37.746MiB peakmem; proj: /tmp/d.nim; out: /tmp/d [SuccessX]

Expected Output

No out-of-bounds line numbers

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions