https://bugs.llvm.org/show_bug.cgi?id=43155

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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);
  make_push_unprofitable(getbyval());
  make_push_unprofitable(getbyval());
  make_push_unprofitable(getbyval());
  return 0;
}

$ clang -S -O2 check.c --target=x86_64-linux -o - -fPIC
...
        callq   exit_manyarg@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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to