summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c
diff options
context:
space:
mode:
authorrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-11 16:20:08 +0000
committerrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-11 16:20:08 +0000
commite6fa0ea601965ab7a19c55ca870bdb2cdebaf324 (patch)
treef0873ca8d26c98fe6770ac353fa336c975e5e22a /gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c
parentd107f37af105e690ccc27609ac1e7ed760b289e9 (diff)
downloadgcc-e6fa0ea601965ab7a19c55ca870bdb2cdebaf324.tar.gz
gcc/
* Makefile.in (OBJS-common): Add tree-ssa-alias-warnings.o. * c-common.c (strict_aliasing_warning): Modify -Wstrict-aliasing logic. * c-common.h (strict_aliasing_warning): Change return type. * c-opts.c (c_common_handle_option): Add call to set_Wstrict_aliasing. * c-typeck.c (build_indirect_ref): Add call to strict_aliasing_warning. (build_c_cast): Condition call to strict_aliasing_warning. * doc/invoke.texi: Update description of -Wstrict-aliasing[=n]. * flags.h (set_Wstrict_aliasing): Declare. * opts.c (set_Wstrict_alising): Define, add call to. * tree-flow.h (strict_aliasing_warning_backend): Declare. * tree-ssa-alias-warnings.c: New file. * tree-ssa-alias.c (compute_may_aliases): Add call to strict_aliasing_warning_backend. gcc/cp * cp/typeck.c (build_indirect_ref): Add call to strict_aliasing_warning. (build_reinterpret_cast_1): Condition call to strict_aliasing_warning. gcc/testsuite * gcc.dg/Wstrict-aliasing-bogus-const-ptr-nonconst-ptr.c: New test. * gcc.dg/Wstrict-aliasing-bogus-never-dereferenced.c: New test. * gcc.dg/Wstrict-aliasing-bogus-struct-included.c: New test. * gcc.dg/Wstrict-aliasing-converted-assigned.c: New test. * gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: New test. * gcc.dg/alias-1.c: Update option: -Wstrict-aliasing=2. * gcc.dg/alias-9.c: Update option: -Wstrict-aliasing=2. * g++.dg/warn/Wstrict-aliasing-7.C: Update option: -Wstrict-aliasing=2. * g++.dg/warn/Wstrict-aliasing-bogus-base-derived.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-char-1.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-const.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-nested-arrays.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C: New test. * g++.dg/warn/Wstrict-aliasing-bogus-union.C: New test. * g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124622 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c
new file mode 100644
index 00000000000..409120f2a40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
+
+
+int foo()
+{
+ int i;
+ *(long*)&i = 0; /* { dg-warning "type-punn" } */
+ return i;
+}