Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 724314
Collapse All | Expand All

(-)gcc-11.1.0.orig/gcc/cp/call.c (-4 lines)
Lines 398-407 build_call_a (tree function, int n, tree Link Here
398
	if (is_empty_class (TREE_TYPE (arg))
398
	if (is_empty_class (TREE_TYPE (arg))
399
	    && simple_empty_class_p (TREE_TYPE (arg), arg, INIT_EXPR))
399
	    && simple_empty_class_p (TREE_TYPE (arg), arg, INIT_EXPR))
400
	  {
400
	  {
401
	    while (TREE_CODE (arg) == TARGET_EXPR)
402
	      /* We're disconnecting the initializer from its target,
403
		 don't create a temporary.  */
404
	      arg = TARGET_EXPR_INITIAL (arg);
405
	    tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (arg));
401
	    tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (arg));
406
	    arg = build2 (COMPOUND_EXPR, TREE_TYPE (t), arg, t);
402
	    arg = build2 (COMPOUND_EXPR, TREE_TYPE (t), arg, t);
407
	    CALL_EXPR_ARG (function, i) = arg;
403
	    CALL_EXPR_ARG (function, i) = arg;
(-)gcc-11.1.0.orig/gcc/cp/cp-gimplify.c (-12 / +1 lines)
Lines 320-329 simple_empty_class_p (tree type, tree op Link Here
320
{
320
{
321
  if (TREE_CODE (op) == COMPOUND_EXPR)
321
  if (TREE_CODE (op) == COMPOUND_EXPR)
322
    return simple_empty_class_p (type, TREE_OPERAND (op, 1), code);
322
    return simple_empty_class_p (type, TREE_OPERAND (op, 1), code);
323
  if (SIMPLE_TARGET_EXPR_P (op)
324
      && TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
325
    /* The TARGET_EXPR is itself a simple copy, look through it.  */
326
    return simple_empty_class_p (type, TARGET_EXPR_INITIAL (op), code);
327
323
328
  if (TREE_CODE (op) == PARM_DECL
324
  if (TREE_CODE (op) == PARM_DECL
329
      && TREE_ADDRESSABLE (TREE_TYPE (op)))
325
      && TREE_ADDRESSABLE (TREE_TYPE (op)))
Lines 473-483 cp_gimplify_expr (tree *expr_p, gimple_s Link Here
473
469
474
	else if (simple_empty_class_p (TREE_TYPE (op0), op1, code))
470
	else if (simple_empty_class_p (TREE_TYPE (op0), op1, code))
475
	  {
471
	  {
476
	    while (TREE_CODE (op1) == TARGET_EXPR)
477
	      /* We're disconnecting the initializer from its target,
478
		 don't create a temporary.  */
479
	      op1 = TARGET_EXPR_INITIAL (op1);
480
481
	    /* Remove any copies of empty classes.  Also drop volatile
472
	    /* Remove any copies of empty classes.  Also drop volatile
482
	       variables on the RHS to avoid infinite recursion from
473
	       variables on the RHS to avoid infinite recursion from
483
	       gimplify_expr trying to load the value.  */
474
	       gimplify_expr trying to load the value.  */
Lines 492-500 cp_gimplify_expr (tree *expr_p, gimple_s Link Here
492
	    gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
483
	    gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
493
			   is_gimple_lvalue, fb_lvalue);
484
			   is_gimple_lvalue, fb_lvalue);
494
	    *expr_p = TREE_OPERAND (*expr_p, 0);
485
	    *expr_p = TREE_OPERAND (*expr_p, 0);
495
	    if (code == RETURN_EXPR && REFERENCE_CLASS_P (*expr_p))
496
	      /* Avoid 'return *<retval>;'  */
497
	      *expr_p = TREE_OPERAND (*expr_p, 0);
498
	  }
486
	  }
499
	/* P0145 says that the RHS is sequenced before the LHS.
487
	/* P0145 says that the RHS is sequenced before the LHS.
500
	   gimplify_modify_expr gimplifies the RHS before the LHS, but that
488
	   gimplify_modify_expr gimplifies the RHS before the LHS, but that
Lines 674-679 cp_gimplify_expr (tree *expr_p, gimple_s Link Here
674
	      || TREE_CODE (TREE_OPERAND (*expr_p, 0)) == MODIFY_EXPR))
662
	      || TREE_CODE (TREE_OPERAND (*expr_p, 0)) == MODIFY_EXPR))
675
	{
663
	{
676
	  expr_p = &TREE_OPERAND (*expr_p, 0);
664
	  expr_p = &TREE_OPERAND (*expr_p, 0);
665
	  code = TREE_CODE (*expr_p);
677
	  /* Avoid going through the INIT_EXPR case, which can
666
	  /* Avoid going through the INIT_EXPR case, which can
678
	     degrade INIT_EXPRs into AGGR_INIT_EXPRs.  */
667
	     degrade INIT_EXPRs into AGGR_INIT_EXPRs.  */
679
	  goto modify_expr_case;
668
	  goto modify_expr_case;
(-)gcc-11.1.0.orig/gcc/cp/cp-tree.h (-1 lines)
Lines 5225-5231 more_aggr_init_expr_args_p (const aggr_i Link Here
5225
   the initializer has void type, it's doing something more complicated.  */
5225
   the initializer has void type, it's doing something more complicated.  */
5226
#define SIMPLE_TARGET_EXPR_P(NODE)				\
5226
#define SIMPLE_TARGET_EXPR_P(NODE)				\
5227
  (TREE_CODE (NODE) == TARGET_EXPR				\
5227
  (TREE_CODE (NODE) == TARGET_EXPR				\
5228
   && TARGET_EXPR_INITIAL (NODE)				\
5229
   && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE))))
5228
   && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE))))
5230
5229
5231
/* True if EXPR expresses direct-initialization of a TYPE.  */
5230
/* True if EXPR expresses direct-initialization of a TYPE.  */
(-)gcc-11.1.0.orig/gcc/testsuite/g++.dg/abi/empty30.C (-14 lines)
Lines 1-14 Link Here
1
// PR c++/94175
2
// { dg-do link }
3
4
struct A {};
5
extern A a;
6
7
int i;
8
__attribute ((noinline, noclone))
9
void f(A) { ++i; }
10
11
int main()
12
{
13
  f(a);
14
}

Return to bug 724314