Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.warn/cast-align1.C

raw
1 // { dg-do assemble { target sparc-*-* } }
2 // { dg-options "-ansi -pedantic-errors -Wcast-align" }
3
4
5 // Copyright (C) 1999 Free Software Foundation, Inc.
6 // Contributed by Nathan Sidwell 7 Dec 1999 <[email protected]>
7
8 // converting a T * to void * does not need a complete T, and doesn't
9 // increase alignment requirements.
10
11 struct X;
12 struct Y;
13 struct Z {double m;};
14
15 void f3 (X *xp, Z *zp)
16 {
17 (void *)xp;
18 (void *)zp;
19 (Y *)xp;
20 (Y *)zp;
21 (Z *)xp;
22 }
23
24 void f4 (char *ptr)
25 {
26 (Z *)ptr; // { dg-warning "" } alignment
27 }