diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-06-25 20:15:08 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-25 17:15:08 +0000 |
| commit | ee51fe592747fc66bd0b5757207583198068b5bd (patch) | |
| tree | 4fb830633880fcad3cce473cd8dc094321f85477 /tests | |
| parent | d48f050cb0209a4ba9819a094ffd1e7a7c2524ee (diff) | |
Fix Phi elimination pass sometimes leaving broken insts in release builds (#7499)
* Make phi elimination pass modify branches in-place
* Add test and fix formatting
* Avoid double removal of param insts
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-7499.slang | 26 | ||||
| -rw-r--r-- | tests/bugs/gh-7499.slang.expected | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/bugs/gh-7499.slang b/tests/bugs/gh-7499.slang new file mode 100644 index 000000000..ea5432758 --- /dev/null +++ b/tests/bugs/gh-7499.slang @@ -0,0 +1,26 @@ +//TEST:EXECUTABLE: +[mutating] +public void f(Ptr<int> arr, inout int size) +{ + for (int i = 0; i < 1; ++i) + arr[i] = 0; + + int end = 0; + if (end >= size) + end = size; + + for (int i = 0; i < 1; ++i) + arr[i] = 0; + + size -= end; +} + +export __extern_cpp int main() +{ + // Success is not crashing the compiler. + int size = 0; + int arr = 0; + f(&arr, size); + + return 0; +} diff --git a/tests/bugs/gh-7499.slang.expected b/tests/bugs/gh-7499.slang.expected new file mode 100644 index 000000000..4c32e2510 --- /dev/null +++ b/tests/bugs/gh-7499.slang.expected @@ -0,0 +1,5 @@ +result code = 0 +standard error = { +} +standard output = { +} |
