Repository navigation
Preserve GNU statement expressions in folded logical operands. [GH #573] - #574
jakub-labenski wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
691a6cb to
d84e8d0
Compare
|
AcknowlEDG review results updated for
CI success. |
|
Issue: #577 |
d84e8d0 to
6967ccc
Compare
nv-cmeerw
left a comment
There was a problem hiding this comment.
Thanks for working on this, just a few nits.
| @@ -0,0 +1,9 @@ | |||
| [GH #577] | |||
| C++-generating back end: GNU statement expressions in logical operands | |||
There was a problem hiding this comment.
I think I would highlight the abort: C++-generating back end: Abort on GNU statement expressions in logical operands
and then ... could abort with a failed assertion in check_for_and_take_source_seq_entry when ..., and maybe instead of the implementation internals just show an example: For example, with --gnu_version=150200:
struct S { bool operator&&(int); };
bool f(int n) {
return false && ({ int i = n; i; }); // Previously triggered an abort.
}There was a problem hiding this comment.
Changed as requested.
| discard_operand(operand_2); | ||
| make_integer_constant_operand(result, (a_host_large_integer)0); | ||
| make_integer_constant_operand(result, | ||
| (a_host_large_integer)(op == eok_lor)); |
There was a problem hiding this comment.
That indentation seems off by one
There was a problem hiding this comment.
Should be fixed now.
6967ccc to
842f281
Compare
|
AcknowlEDG review results updated for
|
|
AcknowlEDG review results updated for
CI success. |
nv-cmeerw
left a comment
There was a problem hiding this comment.
Thanks, looks good to me now.
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||expressions while preserving required behavior when expression results are recorded.