diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2025-10-13 23:14:45 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-13 22:14:45 +0800 |
| commit | 96df31a9fa53e3d897a2b7c4eef021f37f421c91 (patch) | |
| tree | 46cfb983265ce63b619da3b18004d2c163371d2c /source/slang/slang-check-conformance.cpp | |
| parent | f5a3a6dc6a98d22964154f809f9e0dcae30ab67f (diff) | |
Fix segfault on arrays of structs containing parameter blocks (#8555)
Closes https://github.com/shader-slang/slang/issues/8154 However there
is further design work to do on implementing the "NonAddressableType"
suggestion
Diffstat (limited to 'source/slang/slang-check-conformance.cpp')
| -rw-r--r-- | source/slang/slang-check-conformance.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index ba1b8ea55..40ab66e95 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -348,7 +348,11 @@ TypeTag SemanticsVisitor::getTypeTags(Type* type) typeTag = (TypeTag)((int)typeTag | (int)TypeTag::LinkTimeSized); } if (!sized) - typeTag = (TypeTag)((int)typeTag | (int)TypeTag::Unsized); + { + // Unbounded arrays are both Unsized and NonAddressable + typeTag = + (TypeTag)((int)typeTag | (int)TypeTag::Unsized | (int)TypeTag::NonAddressable); + } return typeTag; } @@ -356,6 +360,11 @@ TypeTag SemanticsVisitor::getTypeTags(Type* type) { return getTypeTags(modifiedType->getBase()); } + if (as<ParameterBlockType>(type)) + { + // ParameterBlock types are non-addressable + return TypeTag::NonAddressable; + } if (auto parameterGroupType = as<UniformParameterGroupType>(type)) { auto elementTags = getTypeTags(parameterGroupType->getElementType()); @@ -372,7 +381,9 @@ TypeTag SemanticsVisitor::getTypeTags(Type* type) else if (auto declRefType = as<DeclRefType>(type)) { if (auto aggTypeDecl = as<AggTypeDecl>(declRefType->getDeclRef())) + { return aggTypeDecl.getDecl()->typeTags; + } } return TypeTag::None; } |
