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-opt: DominatorAnalysis::Dominates does not handle OpLabel instructions #3515

Closed
Vasniktel opened this issue Jul 11, 2020 · 1 comment · Fixed by #3516
Closed

spirv-opt: DominatorAnalysis::Dominates does not handle OpLabel instructions #3515

Vasniktel opened this issue Jul 11, 2020 · 1 comment · Fixed by #3516

Comments

@Vasniktel
Copy link
Collaborator

Vasniktel commented Jul 11, 2020

The following test is supposed to fail.

TEST(SegfaultTest, Segfault) {
  std::string shader = R"(
               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
               OpSource ESSL 320
          %2 = OpTypeVoid
          %3 = OpTypeFunction %2
          %4 = OpFunction %2 None %3
          %5 = OpLabel
          %6 = OpUndef %2
               OpReturn
               OpFunctionEnd
  )";

  const auto env = SPV_ENV_UNIVERSAL_1_3;
  const auto consumer = nullptr;
  const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
  ASSERT_TRUE(IsValid(env, context.get()));

  const auto& function = *context->module()->begin();
  auto* op_label = context->get_def_use_mgr()->GetDef(5);
  auto* op_undef = context->get_def_use_mgr()->GetDef(6);
  ASSERT_EXIT(context->GetDominatorAnalysis(&function)->Dominates(
                  op_label, op_undef),
              ::testing::KilledBySignal(SIGSEGV), ".*");
}
@Vasniktel
Copy link
Collaborator Author

@alan-baker @s-perron ping.

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

Successfully merging a pull request may close this issue.

1 participant