Skip to content

Commit 6501f45

Browse files
Merge pull request #512 from Wuerfel21/w21-fix-evans-sdsd-crash
Fix crash reported by evanh and add extra safety check
2 parents c358dd5 + 297d024 commit 6501f45

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backends/asm/optimize_ir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,7 +3710,7 @@ OptimizePeepholes(IRList *irl)
37103710
if (test_is_z && InstrUsesFlags(testir, FLAG_WC)) {
37113711
changeok = false;
37123712
} else if (InstrSetsAnyFlags(testir)) {
3713-
changeok = sawir;
3713+
changeok = sawir && (test_is_c || !FlagsUsedAt(testir,FLAG_WZ));
37143714
lastir = testir;
37153715
break;
37163716
}
@@ -3726,7 +3726,7 @@ OptimizePeepholes(IRList *irl)
37263726
{
37273727
ReplaceZWithNC(testir);
37283728
}
3729-
if (IsBranch(lastir)) {
3729+
if (lastir != NULL && IsBranch(lastir)) {
37303730
ReplaceZWithNC(lastir);
37313731
}
37323732
}

0 commit comments

Comments
 (0)