On 05/04/2017 06:23 AM, Marek Polacek wrote:
On Thu, May 04, 2017 at 02:13:24PM +0200, Richard Biener wrote:
On Thu, May 4, 2017 at 2:11 PM, Marek Polacek <pola...@redhat.com> wrote:
On Thu, May 04, 2017 at 12:42:03PM +0200, Richard Biener wrote:
+static tree
+unwrap_c_maybe_const (tree *tp, int *walk_subtrees, void *)
+{
+  if (TREE_CODE (*tp) == C_MAYBE_CONST_EXPR)
+    {
+      *tp = C_MAYBE_CONST_EXPR_EXPR (*tp);
+      /* C_MAYBE_CONST_EXPRs don't nest.  */
+      *walk_subtrees = false;

This changes trees in-place -- do you need to operate on a copy?

Ugh, yes.  But I can't simply copy_node, because that creates new VAR_DECLs,
and operand_equal_p would consider them unequal.  Hmm...  We need something
else.

unshare_expr?

Yeah, so:

2017-05-04  Marek Polacek  <pola...@redhat.com>

        PR c/80525
        * c-warn.c (unwrap_c_maybe_const): New.
        (warn_logical_operator): Call it.

        * c-c++-common/Wlogical-op-1.c: Don't use -fwrapv anymore.
        * c-c++-common/Wlogical-op-2.c: New test.
OK.
jeff

Reply via email to