[Bug target/81313] New: Bad stack realignment code with -mno-accumulate-outgoing-args
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 4 15:35:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81313
Bug ID: 81313
Summary: Bad stack realignment code with
-mno-accumulate-outgoing-args
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: pavel.v.chupin at gmail dot com
Target Milestone: ---
[hjl@gnu-tools-1 gcc]$ cat /tmp/b.c
extern void foo (void);
void
bar (void)
{
foo ();
}
[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ /tmp/b.c -S -O2
-fno-asynchronous-unwind-tables -mincoming-stack-boundary=3
-mno-accumulate-outgoing-args
[hjl@gnu-tools-1 gcc]$ cat b.s
.file "b.c"
.text
.p2align 4,,15
.globl bar
.type bar, @function
bar:
leaq 8(%rsp), %r10
andq $-16, %rsp
pushq -8(%r10)
pushq %rbp
movq %rsp, %rbp
pushq %r10
subq $8, %rsp
call foo
addq $8, %rsp
popq %r10
popq %rbp
leaq -8(%r10), %rsp
ret
.size bar, .-bar
.ident "GCC: (GNU) 7.1.1 20170704"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 gcc]$ ./xgcc -B./ /tmp/b.c -S -O2
-fno-asynchronous-unwind-tables -mincoming-stack-boundary=3
-maccumulate-outgoing-args
[hjl@gnu-tools-1 gcc]$ cat b.s
.file "b.c"
.text
.p2align 4,,15
.globl bar
.type bar, @function
bar:
pushq %rbp
movq %rsp, %rbp
andq $-16, %rsp
call foo
leave
ret
.size bar, .-bar
.ident "GCC: (GNU) 7.1.1 20170704"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 gcc]$
This is due to
static rtx
ix86_get_drap_rtx (void)
{
if (ix86_force_drap || !ACCUMULATE_OUTGOING_ARGS)
crtl->need_drap = true;
Since nothing is passed on stack, need_trap should be false.
More information about the Gcc-bugs
mailing list