Patch: Implementation of -Wstrict-aliasing, take 3

Diego Novillo dnovillo@acm.org
Thu Apr 26 18:45:00 GMT 2007


Silvius Rus wrote on 04/25/07 19:26:

> -void
> +bool
>  strict_aliasing_warning (tree otype, tree type, tree expr)
>  {
> -  if (flag_strict_aliasing && warn_strict_aliasing
> -      && POINTER_TYPE_P (type) && POINTER_TYPE_P (otype)
> -      && TREE_CODE (expr) == ADDR_EXPR
> +  if (!(flag_strict_aliasing && POINTER_TYPE_P (type) 
> +        && POINTER_TYPE_P (otype) && !VOID_TYPE_P (TREE_TYPE (type))))
> +    return false;

Align predicates vertically.

> -      warn_strict_aliasing = value;
> +      set_Wstrict_aliasing (value);

No mixed capitalization.  How about set_warn_strict_aliasing?


The patch is OK.  I can only approve the alias-specific changes, but
the FE changes look relatively straightforward.  You'll need an FE
maintainer to OK those.



More information about the Gcc-patches mailing list