Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

[spv-in] Bubble up loop breaks, out of switch cases. #2323

Closed

Conversation

eddyb
Copy link
Contributor

@eddyb eddyb commented Apr 27, 2023

The separate commits show the test's old (and broken) behavior, and the change induced by the fix is clear:

diff --git a/tests/out/wgsl/loop-break-from-switch.wgsl b/tests/out/wgsl/loop-break-from-switch.wgsl
index e21c3cf9..530c2ad9 100644
--- a/tests/out/wgsl/loop-break-from-switch.wgsl
+++ b/tests/out/wgsl/loop-break-from-switch.wgsl
@@ -2,17 +2,24 @@ var<private> global: i32;
 var<private> global_1: i32;
 
 fn function() {
+    var local: bool = false;
+
     let _e8 = global;
     loop {
         switch _e8 {
             case 0: {
                 global_1 = 0;
+                local = true;
                 break;
             }
             default: {
                 break;
             }
         }
+        let _e11 = local;
+        if _e11 {
+            break;
+        }
         global_1 = -9;
         break;
     }

@eddyb eddyb force-pushed the spv-in-loop-break-vs-switch-break branch from 9ed3040 to 13c52a0 Compare May 15, 2023 20:27
@cwfitzgerald
Copy link
Member

Hello, thank you for your PR against Naga!

As part of gfx-rs/wgpu#4231, we have moved development of Naga into the wgpu repository in the Naga subfolder. We have transferred all issues, but we are unable to automatically transfer PRs.

As such, please recreate your PR against the wgpu repository. We apologize for the inconvenience this causes, but will make contributing to both projects more streamlined going forward.

We are leaving PRs open, but once they are transferred, please close the original Naga PR.

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

Successfully merging this pull request may close these issues.

[spv-in] Naga miscompiles SPIR-V with branches that exit more than one level of structured control flow
2 participants