[llvm-bugs] [Bug 43155] New: [X68] r270109 can create dead stack adjustments after noreturn calls (previously PR27140)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 28 12:55:17 PDT 2019


            Bug ID: 43155
           Summary: [X68] r270109 can create dead stack adjustments after
                    noreturn calls (previously PR27140)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: craig.topper at gmail.com, hans at chromium.org,
                    llvm-bugs at lists.llvm.org, llvm-dev at redking.me.uk,
                    spatel+llvm at rotateright.com

Here is my gnarly C test case to make this happen on Linux:

__attribute__((noreturn)) void exit_manyarg(int, int, int, int, int, int, int,
int, int, int);
struct ByVal {
  int vals[10];
struct ByVal getbyval();

void make_push_unprofitable(struct ByVal);
void bar();
extern int gv1, gv2, gv3, gv4, gv5, gv6, gv7, gv8, gv9, gv10;
int foo(int c) {
  if (c)
    exit_manyarg(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  return 0;

$ clang -S -O2 check.c --target=x86_64-linux -o - -fPIC
        callq   exit_manyarg at PLT
        subq    $32, %rsp

This only happens with a noreturn function has stack arguments, which is rare
for Linux. However for Win64, the caller must always reserve 32 bytes of stack
space. Currently this bug doesn't happen on Win64, but I plan to make it stop
setting TrapUnreachable, which will make it happen for all noreturn calls, and
then it will matter.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190828/5e3d551e/attachment.html>

More information about the llvm-bugs mailing list