SPV: Protect getStorageClass() with a test that the thing is pointer.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 7d0d3ab..5e43286 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -599,9 +599,11 @@
builder.setAccessChainLValue(id);
} else {
// finish off the entry-point SPV instruction by adding the Input/Output <id>
- spv::StorageClass sc = builder.getStorageClass(id);
- if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
- entryPoint->addIdOperand(id);
+ if (builder.isPointer(id)) {
+ spv::StorageClass sc = builder.getStorageClass(id);
+ if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
+ entryPoint->addIdOperand(id);
+ }
}
}