Skip to content

Conversation

@ringabout
Copy link
Member

fixes #25251

enforce a copy if the arg is a deref of a lent pointer since the arg could be a temporary that will go out of scope

@Araq
Copy link
Member

Araq commented Nov 3, 2025

Doesn't this disable the very optimization we were after?

@ringabout
Copy link
Member Author

Well, in #24093, they asked for optimizations for deref refs

let a = new array[1000, byte]
block:
  for _ in cast[typeof(a)](a)[]:
    discard

@Araq
Copy link
Member

Araq commented Nov 3, 2025

Exactly.

@ringabout
Copy link
Member Author

This PR doesn't disable optimization for #24093, which doesn't use lent

@Araq Araq merged commit 6f73094 into devel Nov 7, 2025
21 checks passed
@Araq Araq deleted the pr_verirren branch November 7, 2025 09:06
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

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

Hint: mm: orc; opt: speed; options: -d:release
183317 lines; 8.244s; 661.727MiB peakmem

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.

Regression in 2.2.6: SIGBUS with iterator over const Table lookup - premature temporary destruction

3 participants