This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34386] -Wstrict-aliasing=3 ineffective (tree-ssa-alias-warnings.c)
- From: "mueller at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Dec 2007 02:07:38 -0000
- Subject: [Bug middle-end/34386] -Wstrict-aliasing=3 ineffective (tree-ssa-alias-warnings.c)
- References: <bug-34386-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from mueller at gcc dot gnu dot org 2007-12-08 02:07 -------
this patch seems to be an alternative way of making -Wstrict-aliasing=3 work
again for the testcase:
--- c-common.c (revision 130658)
+++ c-common.c (working copy)
@@ -1035,7 +1035,8 @@ strict_aliasing_warning (tree otype, tre
&& POINTER_TYPE_P (otype) && !VOID_TYPE_P (TREE_TYPE (type))))
return false;
- if ((warn_strict_aliasing > 1) && TREE_CODE (expr) == ADDR_EXPR
+ if ((warn_strict_aliasing > 1)
+ && (TREE_CODE (expr) == CONVERT_EXPR || TREE_CODE (expr) == ADDR_EXPR)
&& (DECL_P (TREE_OPERAND (expr, 0))
|| handled_component_p (TREE_OPERAND (expr, 0))))
{
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34386