Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack traces broken with arc/orc #19078

Closed
RSDuck opened this issue Oct 31, 2021 · 4 comments
Closed

Stack traces broken with arc/orc #19078

RSDuck opened this issue Oct 31, 2021 · 4 comments

Comments

@RSDuck
Copy link
Contributor

RSDuck commented Oct 31, 2021

Example

proc test =
    assert false

test()

Current Output

something like

c:\Users\...\miauz.nim(5Error: unhandled exception: c:\Users\...\miauz.nim(3, 12) `false`  [AssertionDefect]

Expected Output

c:\Users\...\miauz.nim(5) miauz
c:\Users\...\miauz.nim(3) test
C:\Nim\lib\system\assertions.nim(38) failedAssertImpl
C:\Nim\lib\system\assertions.nim(28) raiseAssert
C:\Nim\lib\system\fatal.nim(53) sysFatal
Error: unhandled exception: c:\Users\...\wegwerfscripte\miauz.nim(3, 12) `false`  [AssertionDefect]

Additional Information

It's definitely a regression, I remember this worked some time ago, but I haven't bisected it yet.

$ nim -v
Nim Compiler Version 1.7.1 [Windows: amd64]
Compiled at 2021-10-31
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 2f730afe9e7eb981258aea257deba0240f488dd1
active boot switches: -d:release
@disruptek
Copy link
Contributor

FWIW, it works on 7b58dc2 which is dated 2021-08-19.

@ghost ghost added the Regression label Oct 31, 2021
@RSDuck
Copy link
Contributor Author

RSDuck commented Nov 1, 2021

the issue only occurs with --exceptions:goto

EDIT: also if this line is removed it "works".

@RSDuck
Copy link
Contributor Author

RSDuck commented Nov 1, 2021

ah I think I found the issue in the C code generated from this function: https://github.com/nim-lang/Nim/blob/devel/lib/system/excpt.nim#L252

						if (!(((NI) 0) < s.p->data[i].line)) goto LA15_;
						prepareAdd((&result), 1);
appendString((&result), TM__Q5wkpxktOdTGvlSRo9bzt9aw_116);
						addInt__stdZprivateZdigitsutils_180((&result), s.p->data[i].line);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;

the exception code is still non zero, that's why that goto after addInt__stdZprivateZdigitsutils_180 is followed and the string is incomplete.

@Araq
Copy link
Member

Araq commented Nov 2, 2021

Workaround --panics:on.

Araq added a commit that referenced this issue Nov 2, 2021
@Araq Araq closed this as completed in 9d51197 Nov 2, 2021
narimiran pushed a commit that referenced this issue Nov 3, 2021
(cherry picked from commit 9d51197)
zacharycarter added a commit to zacharycarter/nimskull that referenced this issue Nov 26, 2021
bors bot added a commit to nim-works/nimskull that referenced this issue Nov 27, 2021
79: fixes regression in Nim - nim-lang/Nim#19078 r=disruptek a=zacharycarter



Co-authored-by: Tail Wag Games <carterza@gmail.com>
PMunch pushed a commit to PMunch/Nim that referenced this issue Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants