Skip to content

C++: Add test that shows that IR generation for <=> is broken #20068

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

Merged
merged 2 commits into from
Jul 16, 2025

Conversation

jketema
Copy link
Contributor

@jketema jketema commented Jul 16, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 13:59
@jketema jketema requested a review from a team as a code owner July 16, 2025 13:59
@github-actions github-actions bot added the C++ label Jul 16, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a test case that demonstrates broken IR (Intermediate Representation) generation for the three-way comparison operator (<=>) in C++20. The test reveals that the IR generation process fails to properly handle spaceship operators, resulting in malformed IR with missing operands and broken control flow.

  • Adds test code with C++20 three-way comparison operator usage
  • Exposes IR generation bugs through both built-in and custom spaceship operators
  • Updates expected test outputs to reflect the broken IR state

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ir.cpp Adds C++20 test code with std::strong_ordering implementation and spaceship operator usage
raw_ir.expected Shows broken IR generation with incomplete spaceship operator handling
raw_consistency.expected Documents IR consistency errors for spaceship operators
aliased_ssa_consistency_unsound.expected Records SSA consistency issues with spaceship operators
aliased_ssa_consistency.expected Documents aliased SSA consistency problems
aliased_ir.expected Shows incomplete IR generation for spaceship operators
PrintAST.expected Records AST representation of the new test code

class ThreeWay {
int x;
public:
std::strong_ordering operator<=>(ThreeWay &y) { return this->x <=> y.x; }
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains a three-way comparison operator (<=>). According to the coding guidelines, .ql and .qll files should not be reviewed for code logic, but this appears to be a C++ test file (.cpp) so this guideline may not apply. However, the purpose is to demonstrate broken IR generation, so the implementation serves its intended testing purpose.

Copilot uses AI. Check for mistakes.

@jketema jketema merged commit 9b8302f into github:main Jul 16, 2025
10 checks passed
@jketema jketema deleted the spaceship-test branch July 16, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants