KhronosGroup / KhronosGroup/glslang

HLSL: frexp triggers assertion

Open
#1,842 0 comments 1 reaction 0 assignees View on GitHub
bug HLSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

This shader:

```
struct ResType
{
float _m0;
int _m1;
};

RWByteAddressBuffer _19 : register(u0);

void comp_main()
{
ResType _371;
_371._m0 = frexp(asfloat(_19.Load(16)), _371._m1);
int itmp = _371._m1;
_19.Store(0, asuint(_371._m0));
}

[numthreads(1, 1, 1)]
void main()
{
comp_main();
}
```

Triggers an assertion:

```
glslangValidator: /home/maister/git/SPIRV-Cross/external/glslang/SPIRV/SpvBuilder.cpp:2717: spv::Id spv::Builder::accessChainGetLValue(): Assertion `accessChain.isRValue == false' failed.
zsh: abort (core dumped) glslangValidator -e main -D -H -V -o /tmp/test.spv /tmp/repro.comp
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the assertion with glslangValidator using the shader in the issue, then inspect accessChainGetLValue() in external/glslang/SPIRV/SpvBuilder.cpp. Confirm the fix by rerunning the same command against /tmp/repro.comp and verifying that compilation completes without the assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.