This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] v3: C++: more location wrapper nodes (PR c++/43064, PR c++/43486)


On 12/7/18 3:13 PM, David Malcolm wrote:
On Tue, 2018-12-04 at 18:31 -0500, Jason Merrill wrote:
On 12/3/18 5:10 PM, Jeff Law wrote:
On 11/19/18 9:51 AM, David Malcolm wrote:
[...]
@@ -1058,6 +1058,9 @@ grokbitfield (const cp_declarator
*declarator,
        return NULL_TREE;
      }
+ if (width)
+    STRIP_ANY_LOCATION_WRAPPER (width);

Why is this needed?  We should already be reducing width to an
unwrapped
constant value somewhere along the line.

"width" is coming from cp_parser_member_declaration, from:

	      /* Get the width of the bitfield.  */
	      width = cp_parser_constant_expression (parser, false, NULL,
						     cxx_dialect >= cxx11);

and currently nothing is unwrapping the value.  We presumably need to
unwrap (or fold?) it before it is stashed in
   DECL_BIT_FIELD_REPRESENTATIVE (value).

Without stripping (or folding) here, we e.g. lose a warning and get this:
   FAIL: g++.dg/abi/empty22.C  -std=gnu++98  (test for warnings, line 15)

Why does that happen? check_bitfield_decl ought to handle the location wrapper fine. That's where it gets folded.

@@ -656,6 +656,9 @@ add_capture (tree lambda, tree id, tree
orig_init, bool by_reference_p,
        listmem = make_pack_expansion (member);
        initializer = orig_init;
      }
+
+  STRIP_ANY_LOCATION_WRAPPER (initializer);

Why is this needed?  What cares about the tree codes of the capture
initializer?

This is used to populate LAMBDA_EXPR_CAPTURE_LIST.  Without stripping,
we end up with wrapped VAR_DECLs, rather than the VAR_DECLs themselves,

Sure, that sounds fine.

and this confuses things later on, for example leading to:

  PASS -> FAIL : g++.dg/cpp0x/lambda/lambda-type.C  -std=c++14 (test for excess errors)
  PASS -> FAIL : g++.dg/cpp0x/lambda/lambda-type.C  -std=c++17 (test for excess errors)

Confuses how?

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]