https://github.com/shader-slang/slang
Revision 63dcc7acf4784d95407866730a70f5d37d391b88 authored by T. Foley on 27 May 2021, 20:40:17 UTC, committed by GitHub on 27 May 2021, 20:40:17 UTC
During lowering from AST to IR, the Slang compiler translates code that uses `struct` inheritance: ```hlsl struct Base { int a; } struct Derived : Base {} ``` into code where the inheritance relationship is "witnessed" by a simple field: ```hlsl struct Base { int a; } struct Derived { Base __anonymous_field__; } ``` The underlying bug here is that the `__anonymous_field__` that the compiler generated during IR lowering was not being given any linkage decorations (no mangled name). As a result, if multiple separately-compiled modules all access that field they could disagree on its identity as an IR instruction. This could lead to output code being generated where the declaration of `__anonymous_field__` uses one IR instruction, but accesses use another. This change includes a fix for the issue, and a test that serves as a reproducer for the original problem.
1 parent 15f5cff
Tip revision: 63dcc7acf4784d95407866730a70f5d37d391b88 authored by T. Foley on 27 May 2021, 20:40:17 UTC
Fix a bug in struct inheritance (#1861)
Fix a bug in struct inheritance (#1861)
Tip revision: 63dcc7a
File | Mode | Size |
---|---|---|
.github | ||
build | ||
docs | ||
examples | ||
external | ||
extras | ||
prelude | ||
source | ||
tests | ||
tools | ||
.editorconfig | -rw-r--r-- | 937 bytes |
.gitattributes | -rw-r--r-- | 95 bytes |
.gitignore | -rw-r--r-- | 1.1 KB |
.gitmodules | -rw-r--r-- | 951 bytes |
CODE_OF_CONDUCT.md | -rw-r--r-- | 3.1 KB |
LICENSE | -rw-r--r-- | 1.1 KB |
README.md | -rw-r--r-- | 6.1 KB |
github_build.sh | -rw-r--r-- | 495 bytes |
github_test.sh | -rw-r--r-- | 546 bytes |
premake.bat | -rw-r--r-- | 120 bytes |
premake5.lua | -rw-r--r-- | 49.0 KB |
slang-com-helper.h | -rw-r--r-- | 4.9 KB |
slang-com-ptr.h | -rw-r--r-- | 4.9 KB |
slang-gfx.h | -rw-r--r-- | 44.6 KB |
slang-tag-version.h | -rw-r--r-- | 36 bytes |
slang.h | -rw-r--r-- | 173.9 KB |
slang.sln | -rw-r--r-- | 21.2 KB |
test.bat | -rw-r--r-- | 1.4 KB |
Computing file changes ...