On 11/10/2017 04:45 PM, David Malcolm wrote:
We need to strip away location wrappers in tree.c predicates like
integer_zerop, otherwise they fail when they're called on
wrapped INTEGER_CST; an example can be seen for
   c-c++-common/Wmemset-transposed-args1.c
in g++.sum, where the warn_for_memset fails to detect integer zero
if the location wrappers aren't stripped.

These shouldn't be needed; callers should have folded away location wrappers. I would hope for STRIP_ANY_LOCATION_WRAPPER to be almost never needed.

warn_for_memset may be missing some calls to fold_for_warn.

  int
  really_constant_p (const_tree exp)
  {
+  STRIP_ANY_LOCATION_WRAPPER (exp);
+
    /* This is not quite the same as STRIP_NOPS.  It does more.  */
    while (CONVERT_EXPR_P (exp)
         || TREE_CODE (exp) == NON_LVALUE_EXPR)

Here we should be able to add VIEW_CONVERT_EXPR to the condition.

Similarly, tree_nop_conversion should treat a VIEW_CONVERT_EXPR to the same type as a nop.

Jason

Reply via email to