From 8be5e1cc7d2c6d8fbc9a9ca8b199b1ae258fd180 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 7 Oct 2011 12:49:56 +0000 Subject: [PATCH] re PR middle-end/50527 (inconsistent vla align) 2011-10-07 Tom de Vries PR middle-end/50527 * gcc.dg/pr50527.c: New test. From-SVN: r179656 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/pr50527.c | 46 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr50527.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7597cd2443e..bedf1a073d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-07 Tom de Vries + + PR middle-end/50527 + * gcc.dg/pr50527.c: New test. + 2011-10-07 Jakub Jelinek PR tree-optimization/50650 diff --git a/gcc/testsuite/gcc.dg/pr50527.c b/gcc/testsuite/gcc.dg/pr50527.c new file mode 100644 index 00000000000..87fae9659d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50527.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-Os --param large-stack-frame=30" } */ + +extern void abort (void); + +void __attribute__((noinline)) +bar (char *a) +{ +} + +void __attribute__((noinline)) +foo (char *a, int b) +{ +} + +void __attribute__((noinline)) +test_align (char *p, int aligned, unsigned int mask) +{ + int p_aligned = ((unsigned long int)p & mask) == 0; + if (aligned != p_aligned) + abort (); +} + +int +main () +{ + const int kIterations = 4; + char results[kIterations]; + int i; + unsigned int mask; + + mask = 0xf; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x7; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x3; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x1; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + + bar (results); + for (i = 0; i < kIterations; i++) + foo ("%d ", results[i]); + + return 0; +}