Skip to content

Keep [[assume]] attribute when its argument call is inlined. [GH #393] - #541

Open
mohitmishra786 wants to merge 1 commit into
edgcpp:mainfrom
mohitmishra786:gh-393-assume-il-check
Open

mohitmishra786 wants to merge 1 commit into
edgcpp:mainfrom
mohitmishra786:gh-393-assume-il-check

Conversation

@mohitmishra786

@mohitmishra786 mohitmishra786 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #393.

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.

@mohitmishra786
mohitmishra786 requested a review from a team November 14, 2026 17:03
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: daveedvdv

Merge Risk: Minimal · up to 6ee67

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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed [#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 Passed 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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cb7d105 and 6ee67be.

Files selected for processing: 4

  • src/lower_il.c
  • src/pending_changes/gh-393-assume-inlined-call.txt
  • tests/tests/changes/.GH393.rto/default.1.1.txt
  • tests/tests/changes/GH393.sft.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 6ee67be14148:

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 6ee67be14148:

CI success.

This branch has not been deployed

No deployments
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.

IL write/read check fails for [[assume]] calling a constexpr function inside a constexpr function

2 participants