summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C27
1 files changed, 27 insertions, 0 deletions
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
index 000000000..43cecab23
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C
@@ -0,0 +1,27 @@
+// { dg-do assemble { target sparc-*-* } }
+// { dg-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; // { dg-warning "" } alignment
+}