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
Preserve GNU statement expressions in folded logical operands. [GH #573] - #574
The C++-generating back end could fail with check_for_and_take_source_seq_entry: wrong entry when the right operand of a short-circuited && or || contained a GNU statement expression. Constant folding removed the operand’s source-sequence entries even when it retained the operand in a backing expression for C++ generation.
Preserve those entries whenever the backing expression is retained. Add regression coverage for both operators in Clang and GCC emulation, including nested expressions with a local type declaration.
No actionable comments were generated in the recent review.
Walkthrough
The constant-folding branch now handles determining cases for both && and ||. It conditionally preserves statement-expression references. Regression cases cover built-in short-circuit operators and statement expressions with local declarations.
Regression cases cover built-in and overloaded logical operators, nested cases, and local declarations in statement expressions. Test configurations invoke Clang and GNU compiler modes.
The change preserves source-sequence entries when a short-circuited operand containing a GNU statement expression is retained for C++ generation. No concrete merge-blocking risk was found, and the regression cases cover both operators in Clang and GNU modes.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states the main change: GNU statement expressions in folded logical operands are now preserved. The raw summary and PR objectives confirm the fix for the `check_for_and_take_source_seq_entry…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title states the main change: GNU statement expressions in folded logical operands are now preserved. The raw summary and PR objectives confirm the fix for the check_for_and_take_source_seq_entry: wrong entry crash in the C++ back end, which keeps source-sequence entries when a short-circuited && or || operand is retained as a backing expression. The title is specific, concise, and includes the issue reference.
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.
The C++-generating back end could fail with check_for_and_take_source_seq_entry: wrong entry when the right operand of a short-circuited && or || contained a GNU statement expression. Constant folding removed the operand’s source-sequence entries even when it retained the operand in a backing expression for C++ generation.
Preserve those entries whenever the backing expression is retained. Add regression coverage for both operators in Clang and GCC emulation, including nested expressions with a local type declaration.
Discussion #573.
Summary by CodeRabbit
&&and||could lose required references to declarations inside GNU statement expressions.