You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep [[assume]] attribute when its argument call is inlined. [GH #393] - #541
Lowering passed the empty statement carrying [[assume]] to lower_full_expr as if the argument were the statement's own expression. When the argument was an inlinable call (e.g. a constexpr function), inlining turned the statement into a block and dropped the attribute, leaving its scoped-expression entry unwritten in the file scope. The argument is now lowered with a NULL statement.
Adds changes/GH393.
Summary by CodeRabbit
Bug Fixes
Fixed handling of [[assume]] attributes whose arguments contain calls, including inlinable calls. These attributes are now preserved during compilation, preventing related IL write/read check failures.
No actionable comments were generated in the recent review.
Walkthrough
Assume-attribute operands on empty statements are now lowered without the statement context. A C++23 regression test covers assume arguments that contain calls, and a pending-changes note records the reported IL write/read check failure.
Changes: Assume operand lowering
Layer / File(s)
Summary
Lower assume operands and test call cases src/lower_il.c, tests/tests/changes/GH393.sft.cpp, tests/tests/changes/.GH393.rto/default.1.1.txt, src/pending_changes/gh-393-assume-inlined-call.txt
lower_full_expr receives a null statement context for assume-attribute operands on empty statements. The C++23 test covers calls in assume arguments, including constexpr, consteval, inline, throwing, and repeated-assumption cases. The test command specifies C++23. The pending-changes note describes the reported IL write/read failure and the lowering change.
This change keeps the [[assume]] attribute when its argument call is inlined, which fixes the reported IL write/read failure. No concrete merge-blocking risk was found. One minor unknown remains: whether the new regression test runs with the checking options that would catch a recurrence.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the [[assume]] attribute is now kept when its argument call is inlined. The raw summary confirms the src/lower_il.c change lowers the argument with a null statement co…
Linked Issues check
[#393] The reported failure is an IL write/read mismatch for scoped-expression entries when an [[assume]] argument contains an inlinable call. The PR summary states that src/lower_il.c now lowers the …
Out of Scope Changes check
All changes relate to #393. src/lower_il.c contains the fix. src/pending_changes/gh-393-assume-inlined-call.txt is the changelog entry for GH393. tests/tests/changes/.GH393.rto/default.1.1.txt adds th…
Full details: Title check
Explanation
The title names the main change: the [[assume]] attribute is now kept when its argument call is inlined. The raw summary confirms the src/lower_il.c change lowers the argument with a null statement context, and the PR objectives describe the same IL write/read failure fix for issue GH #393. The title is specific and matches the changeset.
Full details: Linked Issues check
Explanation
[#393] The reported failure is an IL write/read mismatch for scoped-expression entries when an [[assume]] argument contains an inlinable call. The PR summary states that src/lower_il.c now lowers the assume-attribute argument with a NULL statement for stmk_empty statements (+4/-2). This targets the mechanism in the issue: the attribute's empty statement is passed to lower_full_expr, and inlining can drop the attribute. The added fixture tests/tests/changes/GH393.sft.cpp (+26 lines) covers the issue's cases: a constexpr call that is not folded (g), a constexpr call that is folded or non-constexpr callers (g1, g2, g3), consteval, inline, and throwing callees, and the no-call assumption shape. Its .rto expected output is also updated, with --c++23 added to the test command. Limitation: the text diff of src/lower_il.c could not be read (changed blobs unavailable in checkout), so the code change rests on the PR summary. The behavior was not verified by running the test suite.
Full details: Out of Scope Changes check
Explanation
All changes relate to #393. src/lower_il.c contains the fix. src/pending_changes/gh-393-assume-inlined-call.txt is the changelog entry for GH393. tests/tests/changes/.GH393.rto/default.1.1.txt adds the --c++23 option needed by the new fixture. tests/tests/changes/GH393.sft.cpp is the regression test for the reported cases. No unrelated functional change appears in the PR summary. Limitation: the src/lower_il.c diff was unreadable, so the absence of other hunks in that file rests on the summary's +4/-2 line count.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
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
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.
Fixes #393.
Lowering passed the empty statement carrying
[[assume]]tolower_full_expras if the argument were the statement's own expression. When the argument was an inlinable call (e.g. a constexpr function), inlining turned the statement into a block and dropped the attribute, leaving its scoped-expression entry unwritten in the file scope. The argument is now lowered with a NULL statement.Adds
changes/GH393.Summary by CodeRabbit
[[assume]]attributes whose arguments contain calls, including inlinable calls. These attributes are now preserved during compilation, preventing related IL write/read check failures.