public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/95162] New: -mpreferred-stack-boundary=2 doesn't work with libgcc functions
Date: Sat, 16 May 2020 12:15:54 +0000	[thread overview]
Message-ID: <bug-95162-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95162

            Bug ID: 95162
           Summary: -mpreferred-stack-boundary=2 doesn't work with libgcc
                    functions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com
  Target Milestone: ---
            Target: i386,x86-64

[hjl@gnu-cfl-2 pr95021]$ cat d.c
void
foo (_Decimal32 x)
{
  if (x != 3.0df)
    __builtin_abort ();
}
[hjl@gnu-cfl-2 pr95021]$ make d.s CC=gcc
gcc -O2 -W -m32 -mpreferred-stack-boundary=2 -S d.c
[hjl@gnu-cfl-2 pr95021]$ cat d.s
        .file   "d.c"
        .text
        .globl  __bid_nesd2
        .section        .text.unlikely,"ax",@progbits
.LCOLDB0:
        .text
.LHOTB0:
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        pushl   $838860830
        .cfi_def_cfa_offset 8
        pushl   8(%esp)
        .cfi_def_cfa_offset 12
        call    __bid_nesd2  <<<<<<<< It expects 16 byte alignments.
        popl    %edx
        .cfi_def_cfa_offset 8
        popl    %ecx
        .cfi_def_cfa_offset 4
        testl   %eax, %eax
        jne     .L4
        ret
        .cfi_endproc
        .section        .text.unlikely
        .cfi_startproc
        .type   foo.cold, @function
foo.cold:
.LFSB0:
.L4:
        call    abort
        .cfi_endproc
.LFE0:
        .text
        .size   foo, .-foo
        .section        .text.unlikely
        .size   foo.cold, .-foo.cold
.LCOLDE0:
        .text
.LHOTE0:
        .ident  "GCC: (GNU) 10.1.1 20200507 (Red Hat 10.1.1-1)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr95021]$ 

When calling libgcc functions which expect 16-byte alignments, we should
realign the outgoing stack.

             reply	other threads:[~2020-05-16 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16 12:15 hjl.tools at gmail dot com [this message]
2020-05-16 12:22 ` [Bug target/95162] " hjl.tools at gmail dot com
2020-05-16 12:25 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95162-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).