Skip to content

spirv-fuzz: TransformationMoveBlockDown invalidates the module #3529

@Vasniktel

Description

@Vasniktel

Consider the following file.
shader.txt

It contains a perfectly valid SPIR-V (i.e. the following test succeeds).

TEST(A, a) {
  std::string shader; // code from the file

  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()));
}

However, if we try to move a basic block with id 370 one block down, the transformation will be applied correctly (i.e. TransformationMoveBlockDown::IsApplicable returns true) but the spirv-val will fail with with a somewhat ambiguous message:

error: line 121: Case construct that targets 310[%310] has invalid branch to block 414[%414] (not another case construct, corresponding merge, outer loop merge or outer loop continue)
  %310 = OpLabel

Commit id is 7afbc0c.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions