]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/50527 (inconsistent vla align)
authorTom de Vries <tom@codesourcery.com>
Fri, 7 Oct 2011 12:49:56 +0000 (12:49 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Fri, 7 Oct 2011 12:49:56 +0000 (12:49 +0000)
2011-10-07  Tom de Vries  <tom@codesourcery.com>

PR middle-end/50527
* gcc.dg/pr50527.c: New test.

From-SVN: r179656

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr50527.c [new file with mode: 0644]

index 7597cd2443ee6803b92e336bf44421b36e301a8d..bedf1a073d512ee0e1cabc8e49a9d0c9ac6b8361 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-07  Tom de Vries  <tom@codesourcery.com>
+
+       PR middle-end/50527
+       * gcc.dg/pr50527.c: New test.
+
 2011-10-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/50650
diff --git a/gcc/testsuite/gcc.dg/pr50527.c b/gcc/testsuite/gcc.dg/pr50527.c
new file mode 100644 (file)
index 0000000..87fae96
--- /dev/null
@@ -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;
+}