Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spirv-as hangs in spvReadEnvironmentFromText #5909

Closed
svenvh opened this issue Dec 10, 2024 · 0 comments · Fixed by #5910
Closed

spirv-as hangs in spvReadEnvironmentFromText #5909

svenvh opened this issue Dec 10, 2024 · 0 comments · Fixed by #5910
Assignees
Labels

Comments

@svenvh
Copy link
Member

svenvh commented Dec 10, 2024

Adding some comments to the top of a spvasm file without providing a --target-env flag causes spirv-as to hang inside spvReadEnvironmentFromText; presumably caused by #5893 .

To reproduce, apply the following patch to add a test case:

diff --git a/test/target_env_test.cpp b/test/target_env_test.cpp
index faffa8a1..eb06a691 100644
--- a/test/target_env_test.cpp
+++ b/test/target_env_test.cpp
@@ -221,6 +221,7 @@ INSTANTIATE_TEST_SUITE_P(
         {"     \t ; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},
         // Previous lines
         {"; SPIR-V\n; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},
+        {"; -\n; SPIR-V\n; Version: 1.1", true, SPV_ENV_UNIVERSAL_1_1},
 
         // After a non-header line
         {"OpCapability Shader\n; Version: 1.1", false, kSentinelEnv}}));

Then build and run the test/test_spirv_unit_tests test suite. The TargetTextParsing/TargetParseEnvInDisassemblyTest test will hang.

@svenvh svenvh added the bug label Dec 10, 2024
@dneto0 dneto0 self-assigned this Dec 10, 2024
dneto0 added a commit to dneto0/SPIRV-Tools that referenced this issue Dec 10, 2024
When trying to parse SPIR-V version from assembly comments,
ensure a match against an initial comment doesn't cause the
scanner to go back to the beginning of the assembly text.

Fixed: KhronosGroup#5909
dneto0 added a commit that referenced this issue Dec 11, 2024
When trying to parse SPIR-V version from assembly comments,
ensure a match against an initial comment doesn't cause the
scanner to go back to the beginning of the assembly text.

Fixed: #5909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants