aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/alias-2.c
diff options
context:
space:
mode:
authorJames E Wilson <wilson@specifixinc.com>2004-03-10 06:04:14 +0000
committerJim Wilson <wilson@gcc.gnu.org>2004-03-09 22:04:14 -0800
commit8a308d45d57953297c37fe233b61a042cb563531 (patch)
treee3de107ca5ab570932a9334bdcd238cbee631889 /gcc/testsuite/gcc.dg/alias-2.c
parent5399d643680b153db318cd9ef38787774eac34c4 (diff)
downloadgcc-8a308d45d57953297c37fe233b61a042cb563531.zip
gcc-8a308d45d57953297c37fe233b61a042cb563531.tar.gz
gcc-8a308d45d57953297c37fe233b61a042cb563531.tar.bz2
Testsuite changes for new -Wstrict-aliasing=2 option.
* gcc.dg/alias-1.c: Add "will" to string passed to dg-warning. * gcc.dg/alias-2.c: New testcase. From-SVN: r79223
Diffstat (limited to 'gcc/testsuite/gcc.dg/alias-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/alias-2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/alias-2.c b/gcc/testsuite/gcc.dg/alias-2.c
new file mode 100644
index 0000000..d507416
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/alias-2.c
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" }
+
+struct foo {
+ char c;
+ char d;
+ short s;
+ int i;
+} bar;
+
+int
+sub1 (long long int foobar)
+{
+ struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" }
+ return tmp->i;
+}