summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-09 04:46:09 -0800
committerGitHub <noreply@github.com>2024-12-09 20:46:09 +0800
commit2bec21e91164c8533e93540dc8b610fb24205b7e (patch)
treeadca3721cc12231f0e020ea722ae182cab2a369b /source/slang
parent2e7774a2bfa0da2c5c57fd28c17b26b3b1c3c064 (diff)
Fix crash on recursive types. (#5796)
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-lower-to-ir.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 06c5f005b..75cf421af 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -11384,6 +11384,12 @@ RefPtr<IRModule> generateIRForTranslationUnit(
if (compileRequest->getLinkage()->m_optionSet.shouldRunNonEssentialValidation())
{
+ // We don't allow recursive types.
+ checkForRecursiveTypes(module, compileRequest->getSink());
+
+ if (compileRequest->getSink()->getErrorCount() != 0)
+ return module;
+
// Propagate `constexpr`-ness through the dataflow graph (and the
// call graph) based on constraints imposed by different instructions.
propagateConstExpr(module, compileRequest->getSink());
@@ -11395,10 +11401,6 @@ RefPtr<IRModule> generateIRForTranslationUnit(
// instructions remain.
checkForMissingReturns(module, compileRequest->getSink());
-
- // We don't allow recursive types.
- checkForRecursiveTypes(module, compileRequest->getSink());
-
// Check for invalid differentiable function body.
checkAutoDiffUsages(module, compileRequest->getSink());