The C front end (and perhaps others as well) creates internal
variables in a few places, such as in convert_lvalue_to_rvalue
like so:

      /* Remove the qualifiers for the rest of the expressions and
         create the VAL temp variable to hold the RHS.  */
      nonatomic_type = build_qualified_type (expr_type, TYPE_UNQUALIFIED);
      tmp = create_tmp_var_raw (nonatomic_type);
      tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, false);
      TREE_ADDRESSABLE (tmp) = 1;
      TREE_NO_WARNING (tmp) = 1;

Since the tmp decl "represents a compiler-generated entity" I'm
wondering if the last assignment in this functions (and others like
it) should instead (or in addition) be DECL_ARTIFICIAL (tmp) = 1
(and perhaps whether artificial variables should be treated as if
they had the NO_WARNING bit set; I think this might already be
done somewhere).

I replaced some of these TREE_NO_WARNING macros with DECL_ARTIFICIAL
to see what the effect might be on the tests and in the subset I ran
I saw only a couple of failures due to unexpected warnings that would
be avoided by treating artificial variables as if they also had
the no-warning bit set.

Thanks
Martin

PS The specific failure was gcc.dg/pr60195.c.

Reply via email to