]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Wed, 7 Aug 2002 18:11:00 +0000 (18:11 +0000)
committerNo Author <no-author@gcc.gnu.org>
Wed, 7 Aug 2002 18:11:00 +0000 (18:11 +0000)
'gcc-3_2-branch'.

From-SVN: r56103

gcc/testsuite/g++.dg/abi/bitfield3.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20020805-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/vararg3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/vararg4.c [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/abi/bitfield3.C b/gcc/testsuite/g++.dg/abi/bitfield3.C
new file mode 100644 (file)
index 0000000..1e59935
--- /dev/null
@@ -0,0 +1,80 @@
+// Test for oversized bitfield alignment in structs on IA-32
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-O2" }
+
+struct A
+{
+  char a;
+  int b : 224; // { dg-warning "exceeds its type" "" }
+  char c;
+} a, a4[4];
+
+struct B
+{
+  char d;
+  A e;
+  char f;
+} b;
+
+struct C
+{
+  char g;
+  long long h : 64;
+  char i;
+} c, c4[4];
+
+struct D
+{
+  char j;
+  C k;
+  char l;
+} d;
+
+struct E
+{
+  char m;
+  long long n : 160;   // { dg-warning "exceeds its type" "" }
+  char o;
+} e, e4[4];
+
+struct F
+{
+  char p;
+  E q;
+  char r;
+} f;
+
+int main (void)
+{
+  if (&a.c - &a.a != 32)
+    return 1;
+  if (sizeof (a) != 36)
+    return 2;
+  if (sizeof (a4) != 4 * 36)
+    return 3;
+  if (sizeof (b) != 2 * 4 + 36)
+    return 4;
+  if (__alignof__ (b.e) != 4)
+    return 5;
+  if (&c.i - &c.g != 16)
+    return 6;
+  if (sizeof (c) != 24)
+    return 7;
+  if (sizeof (c4) != 4 * 24)
+    return 8;
+  if (sizeof (d) != 2 * 8 + 24)
+    return 9;
+  if (__alignof__ (d.k) != 8)
+    return 10;
+  if (&e.o - &e.m != 28)
+    return 11;
+  if (sizeof (e) != 32)
+    return 12;
+  if (sizeof (e4) != 4 * 32)
+    return 13;
+  if (sizeof (f) != 2 * 8 + 32)
+    return 14;
+  if (__alignof__ (f.q) != 8)
+    return 15;
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020805-1.c b/gcc/testsuite/gcc.c-torture/execute/20020805-1.c
new file mode 100644 (file)
index 0000000..e7d5179
--- /dev/null
@@ -0,0 +1,21 @@
+/* This testcase was miscompiled on IA-32, because fold-const
+   assumed associate_trees is always done on PLUS_EXPR.  */
+
+extern void abort (void);
+extern void exit (int);
+
+void check (unsigned int m)
+{
+  if (m != (unsigned int) -1)
+    abort ();
+}
+
+unsigned int n = 1;
+
+int main (void)
+{
+  unsigned int m;
+  m = (1 | (2 - n)) | (-n);
+  check (m);
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/cpp/vararg3.c b/gcc/testsuite/gcc.dg/cpp/vararg3.c
new file mode 100644 (file)
index 0000000..b17afd8
--- /dev/null
@@ -0,0 +1,17 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+/* { dg-options "-std=c99" } */
+
+/* Source: Neil Booth, 6 Aug 2002.
+
+   Tests that we DTRT with varargs commas for a single-parameter macro
+   when in standards-conforming mode.  */
+
+#define f(...) , ## __VA_ARGS__
+
+/* The comma from f's expansion should be retained (standards
+   conforming mode only).  Tests that it isn't in non-standards mode
+   include macro8.c and vararg1.c.  */
+#if 2 f() 3              /* { dg-bogus "missing binary operator" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/vararg4.c b/gcc/testsuite/gcc.dg/cpp/vararg4.c
new file mode 100644 (file)
index 0000000..460cebf
--- /dev/null
@@ -0,0 +1,14 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+/* { dg-options -std=gnu99 } */
+
+/* Source: Neil Booth, 6 Aug 2002.
+
+   Tests that we DTRT with varargs commas.  */
+
+#define g(a, ...) a , ## __VA_ARGS__
+
+/* The comma from g's expansion should be retained.  */
+#if g (2, ) 3            /* { dg-bogus "missing binary operator" } */
+#endif