[Bug tree-optimization/51513] Only partially optimizes away __builtin_unreachable switch default case
mirq-gccboogs at rere dot qmqm.pl
gcc-bugzilla@gcc.gnu.org
Tue Apr 7 23:09:03 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51513
Michał Mirosław <mirq-gccboogs at rere dot qmqm.pl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mirq-gccboogs at rere dot qmqm.pl
--- Comment #12 from Michał Mirosław <mirq-gccboogs at rere dot qmqm.pl> ---
Created attachment 48236
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48236&action=edit
testcase
This bug reoccurred in gcc-8. gcc-7 and gcc-9+ seem not affected.
$ gcc-8 -O3 -S b.c -o -
[...]
foo:
.LFB0:
.cfi_startproc
cmpl $1, %edi
jne .L10
movslq %esi, %rsi
leaq foz(%rip), %rax
movl (%rax,%rsi,4), %eax
movl %eax, (%rdx)
xorl %eax, %eax
ret
.p2align 4,,10
.p2align 3
.L10:
cmpl $2, %edi
jne .L11
.L3:
movslq %esi, %rsi
leaq baz(%rip), %rax
movl (%rax,%rsi,4), %eax
movl %eax, (%rdx)
xorl %eax, %eax
ret
.p2align 4,,10
.p2align 3
.L11:
testl %edi, %edi
je .L3
.cfi_endproc
[...]
$ gcc-8 -O -S b.c -o -
[...]
foo:
.LFB0:
.cfi_startproc
cmpl $1, %edi
je .L2
cmpl $2, %edi
je .L3
testl %edi, %edi
jne .L4
.L3:
movslq %esi, %rsi
leaq baz(%rip), %rax
movl (%rax,%rsi,4), %eax
movl %eax, (%rdx)
.L5:
movl $0, %eax
ret
.L2:
movslq %esi, %rsi
leaq foz(%rip), %rax
movl (%rax,%rsi,4), %eax
movl %eax, (%rdx)
jmp .L5
.L4:
.cfi_endproc
More information about the Gcc-bugs
mailing list