* g++.old-deja/g++.warn/cast-align1.C: New test.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 12:40:30 +0000 (12:40 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 12:40:30 +0000 (12:40 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30953 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C [new file with mode: 0644]

index 4aa9038..e623b37 100644 (file)
@@ -1,3 +1,7 @@
+1999-12-15  Nathan Sidwell  <nathan@acm.org>
+
+       * g++.old-deja/g++.warn/cast-align1.C: New test.
+
 1999-12-14  Bernd Schmidt  <bernds@cygnus.co.uk>
 
        * gcc.dg/991214-1.c: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C b/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C
new file mode 100644 (file)
index 0000000..2876bf7
--- /dev/null
@@ -0,0 +1,28 @@
+// Build don't link:
+// Skip if not target: sparc-*-*
+
+// Special g++ Options: -ansi -pedantic-errors -Wcast-align
+
+// Copyright (C) 1999 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 7 Dec 1999 <nathan@acm.org>
+
+// converting a T * to void * does not need a complete T, and doesn't
+// increase alignment requirements.
+
+struct X;
+struct Y;
+struct Z {double m;};
+
+void f3 (X *xp, Z *zp)
+{
+  (void *)xp;
+  (void *)zp;
+  (Y *)xp;
+  (Y *)zp;
+  (Z *)xp;
+}
+
+void f4 (char *ptr)
+{
+  (Z *)ptr;           // WARNING - alignment
+}