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

don't try to transform objconstr/cast type nodes #24636

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Jan 21, 2025

fixes #24631

Object constructors, casts and type conversions copy their type nodes verbatim instead of producing semchecked type nodes. This causes a crash in transf when an untyped expression in the type node has nil type. To deal with this, don't try to transform the type node in these expressions at all. I couldn't reproduce the problem with type conversion nodes though so those are unchanged in transf.

@metagn metagn mentioned this pull request Jan 22, 2025
@metagn metagn force-pushed the transf-obj-constr-conv-type branch from 88edf53 to d1112d4 Compare January 22, 2025 04:58
@Araq Araq merged commit 6d59680 into nim-lang:devel Jan 22, 2025
18 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 6d59680

Hint: mm: orc; opt: speed; options: -d:release
178421 lines; 9.196s; 651.406MiB peakmem

narimiran pushed a commit that referenced this pull request Jan 24, 2025
fixes #24631

[Object
constructors](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semobjconstr.nim#L462),
[casts](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semexprs.nim#L494)
and [type
conversions](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semexprs.nim#L419)
copy their type nodes verbatim instead of producing semchecked type
nodes. This causes a crash in transf when an untyped expression in the
type node has `nil` type. To deal with this, don't try to transform the
type node in these expressions at all. I couldn't reproduce the problem
with type conversion nodes though so those are unchanged in transf.

(cherry picked from commit 6d59680)
narimiran pushed a commit that referenced this pull request Jan 27, 2025
fixes #24631

[Object
constructors](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semobjconstr.nim#L462),
[casts](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semexprs.nim#L494)
and [type
conversions](https://github.com/nim-lang/Nim/blob/793baf34ff72cb8c5485ce209af086e27f656853/compiler/semexprs.nim#L419)
copy their type nodes verbatim instead of producing semchecked type
nodes. This causes a crash in transf when an untyped expression in the
type node has `nil` type. To deal with this, don't try to transform the
type node in these expressions at all. I couldn't reproduce the problem
with type conversion nodes though so those are unchanged in transf.

(cherry picked from commit 6d59680)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compile-time SIGSEGV with template y(): V[false] = V[false](l: 0)
2 participants