public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95162] New: -mpreferred-stack-boundary=2 doesn't work with libgcc functions
@ 2020-05-16 12:15 hjl.tools at gmail dot com
  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
  0 siblings, 2 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-16 12:15 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/95162] -mpreferred-stack-boundary=2 doesn't work with libgcc functions
  2020-05-16 12:15 [Bug target/95162] New: -mpreferred-stack-boundary=2 doesn't work with libgcc functions hjl.tools at gmail dot com
@ 2020-05-16 12:22 ` hjl.tools at gmail dot com
  2020-05-16 12:25 ` hjl.tools at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-16 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
GCC manual says

'-mpreferred-stack-boundary=NUM'
     Attempt to keep the stack boundary aligned to a 2 raised to NUM
     byte boundary.  If '-mpreferred-stack-boundary' is not specified,
     the default is 4 (16 bytes or 128-bits).

     *Warning:* If you use this switch, then you must build all modules
     with the same value, including any libraries.  This includes the
     system libraries and startup modules.

c-c++-common/dfp/func-vararg-mixed-2.c has

/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* { dg-options "-mpreferred-stack-boundary=2" } */

which works by pure luck.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/95162] -mpreferred-stack-boundary=2 doesn't work with libgcc functions
  2020-05-16 12:15 [Bug target/95162] New: -mpreferred-stack-boundary=2 doesn't work with libgcc functions hjl.tools at gmail dot com
  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
  1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-16 12:25 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Invalid.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-16 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 12:15 [Bug target/95162] New: -mpreferred-stack-boundary=2 doesn't work with libgcc functions hjl.tools at gmail dot com
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

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).