Skip to content

non-integer parameters to or/and intrinsics crash the compiler #7057

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

Closed
pow2clk opened this issue Jan 13, 2025 · 0 comments · Fixed by #7060 or #7091
Closed

non-integer parameters to or/and intrinsics crash the compiler #7057

pow2clk opened this issue Jan 13, 2025 · 0 comments · Fixed by #7060 or #7091
Assignees
Labels
bug Bug, regression, crash needs-triage Awaiting triage

Comments

@pow2clk
Copy link
Member

pow2clk commented Jan 13, 2025

Description
Providing floating point values to and/or intrinsics results in a compiler crash.

Steps to Reproduce

Passing floating values, whether scalars or vectors, from any source to either or or and.
https://godbolt.org/z/aa8v4T6sd

Actual Behavior
Results in an internal compiler error.

Environment

  • DXC version: 1.8.2407
  • Host Operating System macos
@pow2clk pow2clk added bug Bug, regression, crash needs-triage Awaiting triage labels Jan 13, 2025
@pow2clk pow2clk self-assigned this Jan 13, 2025
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 13, 2025
And/or intrinsics were set to allow any parameters, which is consistent with the behavior of the && and || operators they were meant to replace, however this meant that if they were passed floating point values, those values would be applied to the binary and/or operands, which isn't allowed. Instead, they should be converted to booleans to be consistent with the behavior of && and ||. This can be done simply by restricting the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different sized vectors, and matrices as parameters to or and and.

Fixes microsoft#7057
@pow2clk pow2clk moved this to Triaged in HLSL Triage Jan 13, 2025
@pow2clk pow2clk moved this from New to In review in HLSL Roadmap Jan 13, 2025
@pow2clk pow2clk added this to the Release 1.8.2502 milestone Jan 13, 2025
@pow2clk pow2clk moved this to Needs Review in HLSL Support Jan 13, 2025
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 21, 2025
And/or intrinsics were set to allow any parameters, which is consistent with the behavior of the && and || operators they were meant to replace, however this meant that if they were passed floating point values, those values would be applied to the binary and/or operands, which isn't allowed. Instead, they should be converted to booleans to be consistent with the behavior of && and ||. This can be done simply by restricting the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different sized vectors, and matrices as parameters to or and and.

Fixes microsoft#7057
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 22, 2025
And/or intrinsics were set to allow any parameters, which is consistent with the behavior of the && and || operators they were meant to replace, however this meant that if they were passed floating point values, those values would be applied to the binary and/or operands, which isn't allowed. Instead, they should be converted to booleans to be consistent with the behavior of && and ||. This can be done simply by restricting the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different sized vectors, and matrices as parameters to or and and.

Fixes microsoft#7057
@github-project-automation github-project-automation bot moved this from Needs Review to Closed in HLSL Support Jan 22, 2025
@github-project-automation github-project-automation bot moved this from Needs Review to Closed in HLSL Support Jan 22, 2025
@github-project-automation github-project-automation bot moved this from In review to Done in HLSL Roadmap Jan 22, 2025
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 27, 2025
And/or intrinsics were set to allow any parameters, which is consistent
with the behavior of the && and || operators they were meant to replace,
however this meant that if they were passed floating point values, those
values would be applied to the binary and/or operands, which isn't
allowed. Instead, they should be converted to booleans to be consistent
with the behavior of && and ||. This can be done simply by restricting
the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different
sized vectors, and matrices as parameters to or and and.

Fixes: microsoft#7057
FIxes: microsoft#6995
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 27, 2025
And/or intrinsics were set to allow any parameters, which is consistent
with the behavior of the && and || operators they were meant to replace,
however this meant that if they were passed floating point values, those
values would be applied to the binary and/or operands, which isn't
allowed. Instead, they should be converted to booleans to be consistent
with the behavior of && and ||. This can be done simply by restricting
the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different
sized vectors, and matrices as parameters to or and and.

Fixes: microsoft#7057
FIxes: microsoft#6995
(cherry picked from commit 25faa88)
pow2clk added a commit that referenced this issue Jan 27, 2025
Cherry-pick of #7060 to release-1.8.2502
    
And/or intrinsics were set to allow any parameters, which is consistent
with the behavior of the && and || operators they were meant to replace,
however this meant that if they were passed floating point values, those
values would be applied to the binary and/or operands, which isn't
allowed. Instead, they should be converted to booleans to be consistent
with the behavior of && and ||. This can be done simply by restricting
the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different
sized vectors, and matrices as parameters to or and and.
    
Fixes: #7057
Fixes: #6995
(cherry picked from commit 25faa88)
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 29, 2025
And/or intrinsics were set to allow any parameters, which is consistent
with the behavior of the && and || operators they were meant to replace,
however this meant that if they were passed floating point values, those
values would be applied to the binary and/or operands, which isn't
allowed. Instead, they should be converted to booleans to be consistent
with the behavior of && and ||. This can be done simply by restricting
the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different
sized vectors, and matrices as parameters to or and and.

Fixes: microsoft#7057
FIxes: microsoft#6995
(cherry picked from commit 25faa88)
pow2clk added a commit that referenced this issue Jan 29, 2025
And/or intrinsics were set to allow any parameters, which is consistent
with the behavior of the && and || operators they were meant to replace,
however this meant that if they were passed floating point values, those
values would be applied to the binary and/or operands, which isn't
allowed. Instead, they should be converted to booleans to be consistent
with the behavior of && and ||. This can be done simply by restricting
the parameters to booleans which forces the appropriate conversions.
Adds tests for for using bools, ints, and floats in scalars, different
sized vectors, and matrices as parameters to or and and.

Fixes: #7057
FIxes: #6995
(cherry picked from commit 25faa88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage
Projects
Status: Done
Archived in project
1 participant