Repository navigation
Conversation
`putArgInto` did not know `nkCheckedFieldExpr`, the access of a field in a case branch, so such an argument of an inline iterator was always copied into a temporary, a 4 MB stack array per loop in the issue (stack overflow), whereas the same field outside of a case branch is mapped directly like any other field access path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment An inline iterator argument like `p()[].v` (a field behind the pointer that a call returns) was copied as a whole into a temporary, the array of the issue onto the stack, because its root is a call. #24093 already evaluated only the pointer for `p()[]` itself; this now also covers field access paths (`nkDotExpr`, `nkCheckedFieldExpr`) on top of such a deref: the pointer goes into a temporary and the formal parameter is mapped to the path rooted at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Araq
force-pushed
the
araq-tersec-bugs1
branch
from
December 5, 2026 18:46
884a273 to
b813100
Compare
…body When an inline iterator yields more than once, the loop body is duplicated and `introduceNewLocalVars` gives the copy fresh local variables. A lambda without an environment (at the top level it reads the global loop variables directly) was not duplicated however: * in a `var`/`let` initializer `transformVarSection` ran `transform` instead of `introduceNewLocalVars` over the value, and * the `nkClosure` that wraps such a lambda was returned unchanged. So every copy of the loop body used the first lambda, which accesses the variables of the first copy: wrong results (#16417), or invalid C code when the first copy is not generated at all, as for the `when nimvm` branch (#25122, #15353). Now the initializers of a duplicated body go through `introduceNewLocalVars` and so does the lambda of an environment-less closure, which copies the routine with the fresh variables mapped. fixes #15353, fixes #16417 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a re-exported module importSymbol picks the first symbol named `x` from the interface of `m` and, if it is not a single exportable symbol, iterates over all symbols of that name. The loop then checked the kind of that *first* symbol instead of the current one, so when the first hit was the re-exported module `x` (skModule is not exportable) no overload was imported at all. Check the kind of each iterated symbol instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anch Object construction with a runtime discriminator only looked for an enclosing `case` statement when the discriminator value was a plain symbol, so `case x.h of ...: K(h: x.h, ...)` fell through to the literal comparison and reported a bogus branch conflict. The discriminator value may now be any field access path (`a.b.c`, no dereference) whose root is an immutable `let`/parameter; the enclosing `case` is found by structural equality of the selector, and the immutability check is done on the root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aint For `proc w[T: uint](v: T)` the call `w(0)` matched the constraint `uint` only via a conversion, yet `T` was bound to the type of the argument (`int`), contradicting the constraint. When the argument matches a concrete (non-meta) constraint only by a conversion (isConvertible, isIntConv, isFromIntLit), `T` is now bound to the constraint itself and the argument is converted to it. Subtype matches still bind the argument's type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recursive type classes no longer crash the compiler; they are reported as "illegal recursion in type". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…are on Since #26509 the `nimln_`/`nimlf_` stack trace marker is written on its own line after the `#line N` directive. A `#line` directive names the line that immediately follows it, so the marker got line N and the statement itself N+1: every statement compiled with `--lineDir:on --stackTrace:on` was attributed to the next Nim line (C compiler/assembler diagnostics, debugger line info, `__LINE__`), and multi-line asm reported lines past the end of the file. Restate the `#line` directive after the marker. Note that the assembler still counts the lines of the asm text itself, so an asm string with N embedded `\n` written on one Nim line is reported as N consecutive lines; that cannot be expressed with C `#line` directives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…piler
`externalFileChanged` parsed the footprint of a `{.compile.}`d file with
`parseSecureHash(f.readLine())`, which raises EOFError on an empty file and
IndexDefect on a truncated one; both are left behind by an interrupted
build. Compare the stored line with the current hash instead, so anything
else simply counts as "changed" and the file is recompiled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Valgrind is clean for `addExitProc` with -d:useMalloc under orc, arc and refc on devel; only the 2.0 line destroyed the exit proc seq before the atexit handler read it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Araq
force-pushed
the
araq-tersec-bugs1
branch
from
December 5, 2026 22:10
b813100 to
78f8583
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A batch of fixes for open issues, one commit per issue (best merged as rebase so each fix can be backported on its own).
iteratorand case object #25287; evaluate only the pointer of a field path iterator argumentiteratorwithwhen nimvm:error: ‘c__r_u3’ undeclared (first use in this function); did you mean ‘c__r_u10’#25122; duplicate lambdas of a duplicated inline-iterator loop bodyError: undeclared identifieraccessing exported symbol specifically when usingfrom/import#25536;from m import xskipped routines whenxalso names a re-exported modulethe field(s) 'g' are in conflict with this value#23762; a field path of an immutable location selects a case branchuint64incorrectly has parameter withinttype #25194; bind a constrained generic param to its concrete constraintasm ".warning \"\"\n.warning \"\"\n.warning \"\"\n.warning \"\"\n"Nim--lineDir:oncan generate out-of-bounds line numbers #25923;#linedirectives were one line off when stack traces are on{.compile: "foo.c".}when@mfoo.sha1in cache is empty results inError: unhandled exception: EOF reached [EOFError]#23364; an empty or truncated.sha1footprint crashed the compileraddExitProcfromstd/exitprocsin Nim 2.0 but notdevel#23309; regression test only🤖 Generated with Claude Code