https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66215
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Following testcase is wrongly compiled event with -O2 optimization level.
$ cat o2-test-case.c
static int a;
int t(int tt)
{
switch (tt)
{
case 1: return a;
}
return 0;
}
$ ./xgcc -B. -mhotpatch=2,3 -O2 -fno-inline -o /tmp/test.s -S o2-test-case.c
$ head -n20 /tmp/test.s
.file "o2-test-case.c"
.text
.align 8
.globl t
.type t, @function
nopr %r7 # pre-label NOPs for hotpatch (2 halfwords)
nopr %r7
# alignment for hotpatch
.align 8
t:
marxin@marxinbox:~/Programming/gcc2/objdir/gcc> head -n20 /tmp/test.s
.file "o2-test-case.c"
.text
.align 8
.globl t
.type t, @function
nopr %r7 # pre-label NOPs for hotpatch (2 halfwords)
nopr %r7
# alignment for hotpatch
.align 8
t:
# post-label NOPs for hotpatch (3 halfwords)
.LFB0:
st %r14,56(%r15)
nop 0
nopr %r7
.LCFI0:
l %r4,56(%r15)
lhi %r2,0
l %r14,56(%r15)
.LCFI1: