diff mbox

PR testsuite/70520: Backport r265322 from llvm upstream

Message ID 20160502211148.GA19295@intel.com
State New
Headers show

Commit Message

H.J. Lu May 2, 2016, 9:11 p.m. UTC
Since x86 psABIs require the function incoming stack must align at 16
bytes, child process stack passed to clone should be aligned at 16
bytes.

Tested on Linux/x86-64.  OK for trunk?


H.J.
	PR testsuite/70520
	* c-c++-common/asan/clone-test-1.c (main): Align child process
	stack to 16 bytes.
---
 gcc/testsuite/c-c++-common/asan/clone-test-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Jelinek May 2, 2016, 9:43 p.m. UTC | #1
On Mon, May 02, 2016 at 02:11:49PM -0700, H.J. Lu wrote:
> Since x86 psABIs require the function incoming stack must align at 16
> bytes, child process stack passed to clone should be aligned at 16
> bytes.
> 
> Tested on Linux/x86-64.  OK for trunk?
> 
> 
> H.J.
> 	PR testsuite/70520
> 	* c-c++-common/asan/clone-test-1.c (main): Align child process
> 	stack to 16 bytes.

Ok.
> ---
>  gcc/testsuite/c-c++-common/asan/clone-test-1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/testsuite/c-c++-common/asan/clone-test-1.c b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> index fd187aa..eeca09f 100644
> --- a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> +++ b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> @@ -25,7 +25,7 @@ volatile int zero = 0;
>  int main(int argc, char **argv) {
>    int i;
>    const int kStackSize = 1 << 20;
> -  char child_stack[kStackSize + 1];
> +  char __attribute__((aligned(16))) child_stack[kStackSize + 1];
>    char *sp = child_stack + kStackSize;  /* Stack grows down. */
>    printf("Parent: %p\n", sp);
>    pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);
> -- 
> 2.5.5

	Jakub
diff mbox

Patch

diff --git a/gcc/testsuite/c-c++-common/asan/clone-test-1.c b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
index fd187aa..eeca09f 100644
--- a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
+++ b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
@@ -25,7 +25,7 @@  volatile int zero = 0;
 int main(int argc, char **argv) {
   int i;
   const int kStackSize = 1 << 20;
-  char child_stack[kStackSize + 1];
+  char __attribute__((aligned(16))) child_stack[kStackSize + 1];
   char *sp = child_stack + kStackSize;  /* Stack grows down. */
   printf("Parent: %p\n", sp);
   pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);