Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tools/clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3504,12 +3504,14 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
Ty = Context.LitIntTy;
if (Literal.GetIntegerValue(ResultVal)) {
// If this value didn't fit into 64-bit literal int, report error.
Diag(Tok.getLocation(), diag::err_integer_literal_too_large);
Diag(Tok.getLocation(), diag::err_integer_literal_too_large)
<< /* Unsigned */ 1;
}
} else {

if (Literal.GetIntegerValue(ResultVal)) {
Diag(Tok.getLocation(), diag::err_integer_literal_too_large);
Diag(Tok.getLocation(), diag::err_integer_literal_too_large)
<< /* Unsigned */ 1;
}
if (Literal.isLongLong) {
if (Literal.isUnsigned)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %dxc -T lib_6_6 %s | FileCheck %s

// A diagnostic is generated for an integer literal that is too large to be
// represented by any integer type - an argument indicates whether the text
// contains "signed". That argument was missing in HLSL specific code within
// Sema::ActOnNumericConstant() which resulted in an assert being raised if
// the diagnostic was generated in an assert enabled DXC and a random string
// being inserted in a non-assert enabled DXC.

// CHECK: integer literal is too large to be represented in any integer type
int a = 98765432109876543210;

// CHECK: integer literal is too large to be represented in any integer type
uint b = 98765432109876543210U;