Files to reproduce problem
glsl_reduced.frag is a minimized GLSL shader. When compiled to SPIR-V with glslangValidator we get glsl_reduced.spv. This has been further reduced using spirv-reduce to spiv_reduced.spv.
Doing:
spirv-opt spirv_reduced.spv --combine-access-chains --redundancy-elimination --combine-access-chains --combine-access-chains --reduce-load-size --eliminate-dead-branches --merge-return --eliminate-dead-inserts --eliminate-local-single-store --eliminate-local-single-block --eliminate-dead-code-aggressive --eliminate-dead-inserts --scalar-replacement=100 --eliminate-dead-branches --merge-return --eliminate-dead-inserts --redundancy-elimination --eliminate-dead-inserts --eliminate-dead-inserts --copy-propagate-arrays --eliminate-local-single-block --if-conversion --eliminate-dead-code-aggressive -o temp.spv
spirv-val temp.spv
should trigger the problem:
error: line 26: Case construct that targets 39[%39] has invalid branch to block 44[%44] (not another case construct, corresponding merge, outer loop merge or outer loop continue)
%39 = OpLabel
I did not try to reduce the spirv-opt flags, in case (as with #2450) there may be an issue both with the optimizer generating invalid code and the validator not picking this up soon enough.
Found using GraphicsFuzz