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

fixes #22389; fixes #19840; don't fold paths containing addr #23807

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

ringabout
Copy link
Member

fixes #22389;
fixes #19840

@Araq Araq added the merge_when_passes_CI mergeable once green label Jul 8, 2024
@narimiran narimiran merged commit 5c5e7a9 into devel Jul 9, 2024
21 checks passed
@narimiran narimiran deleted the pr_fold_addr branch July 9, 2024 10:59
Copy link
Contributor

github-actions bot commented Jul 9, 2024

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

Hint: mm: orc; opt: speed; options: -d:release
173183 lines; 8.134s; 664.109MiB peakmem

metagn added a commit to metagn/Nim that referenced this pull request Oct 17, 2024
Araq pushed a commit that referenced this pull request Oct 18, 2024
fixes #24305, refs #23807

Since #23014 `nkHiddenAddr` is produced to fast assign array elements in
iterators. However the array access inside this `nkHiddenAddr` can get
folded at compile time, generating invalid code. In #23807, compile time
folding of regular `addr` expressions was changed to be prevented in
`transf` but `nkHiddenAddr` was not updated alongside it.

The method for preventing folding in `addr` in #23807 was also faulty,
it should only trigger on the immediate child node of the address rather
than all nodes nested inside it. This caused a regression as outlined in
[this
comment](#24322 (comment)).

To fix both issues, `addr` and `nkHiddenAddr` now both shallowly prevent
constant folding for their immediate children.
narimiran pushed a commit that referenced this pull request Oct 28, 2024
narimiran pushed a commit that referenced this pull request Oct 28, 2024
fixes #24305, refs #23807

Since #23014 `nkHiddenAddr` is produced to fast assign array elements in
iterators. However the array access inside this `nkHiddenAddr` can get
folded at compile time, generating invalid code. In #23807, compile time
folding of regular `addr` expressions was changed to be prevented in
`transf` but `nkHiddenAddr` was not updated alongside it.

The method for preventing folding in `addr` in #23807 was also faulty,
it should only trigger on the immediate child node of the address rather
than all nodes nested inside it. This caused a regression as outlined in
[this
comment](#24322 (comment)).

To fix both issues, `addr` and `nkHiddenAddr` now both shallowly prevent
constant folding for their immediate children.

(cherry picked from commit 52cf7df)
narimiran pushed a commit that referenced this pull request Oct 28, 2024
fixes #22389;
fixes #19840

(cherry picked from commit 5c5e7a9)
(cherry picked from commit 00e39185f1d59597d17b69bbccf8879e3427f928)
narimiran pushed a commit that referenced this pull request Oct 28, 2024
fixes #24305, refs #23807

Since #23014 `nkHiddenAddr` is produced to fast assign array elements in
iterators. However the array access inside this `nkHiddenAddr` can get
folded at compile time, generating invalid code. In #23807, compile time
folding of regular `addr` expressions was changed to be prevented in
`transf` but `nkHiddenAddr` was not updated alongside it.

The method for preventing folding in `addr` in #23807 was also faulty,
it should only trigger on the immediate child node of the address rather
than all nodes nested inside it. This caused a regression as outlined in
[this
comment](#24322 (comment)).

To fix both issues, `addr` and `nkHiddenAddr` now both shallowly prevent
constant folding for their immediate children.

(cherry picked from commit 52cf7df)
(cherry picked from commit 7ad7ee03e5c0adb6832cbae10a62de7b68ef6fa5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge_when_passes_CI mergeable once green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Returning address of constant array emits invalid C code copyMem from a const prevents compiling
3 participants