Skip to content

Minor fix for signedness of asuint bitcast #7623

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

petermcneeleychromium
Copy link

The Result of a bitcast via 'asuint' should be unsigned.

Code that will (incorrectly) generate an assert.

RWByteAddressBuffer v : register(u0);
void foo() {
  int v_1 = int(0);
  v.InterlockedAdd(int(16u), asint((asuint(int(0)) - asuint(int(123)))), v_1);
  int x = v_1;
}

Failing code (6199) '/dxc/tools/clang/lib/AST/ExprConstant.cpp'

  assert(SI.isSigned() == E->getType()->isSignedIntegerOrEnumerationType() &&
           "Invalid evaluation result.");

@dneto0 dneto0 self-requested a review July 4, 2025 14:32
@dneto0 dneto0 requested a review from s-perron July 4, 2025 14:47
Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

@s-perron s-perron requested a review from llvm-beanz July 4, 2025 18:39
@s-perron
Copy link
Collaborator

s-perron commented Jul 4, 2025

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@s-perron s-perron requested a review from damyanp July 4, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

3 participants