https://llvm.org/bugs/show_bug.cgi?id=26023
Bug ID: 26023 Summary: LLVM -0z push/pop optimization clobbers the red zone Product: libraries Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Backend: X86 Assignee: unassignedb...@nondot.org Reporter: david.majne...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified consider: $ cat t.c #include <stdio.h> int f() { volatile char x[120] __attribute__((aligned(1))); asm volatile("" : : "g"(x) : "memory"); x[119] = -2; asm volatile("" : : "r"(-1)); return x[119]; } int main() { int x = f(); printf("%d\n", x); } compile with: $ ~/llvm/Debug+Asserts/bin/clang -Oz t.c -o t run it: $ ./t -1 the correct result is -2 but we push/pop'd -1 on to the stack, clobbering the end of 'x' which exists on the red zone. Reverting r255656, the commit which introduced the optimization, fixes this. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs