View | Details | Raw Unified | Return to bug 35634 | Differences between
and this patch

Collapse All | Expand All

(-)gcc/fold-const.c.jj (-1 / +5 lines)
Lines 2701-2706 maybe_lvalue_p (const_tree x) Link Here
2701
tree
2701
tree
2702
non_lvalue (tree x)
2702
non_lvalue (tree x)
2703
{
2703
{
2704
  tree ret;
2705
2704
  /* While we are in GIMPLE, NON_LVALUE_EXPR doesn't mean anything to
2706
  /* While we are in GIMPLE, NON_LVALUE_EXPR doesn't mean anything to
2705
     us.  */
2707
     us.  */
2706
  if (in_gimple_form)
2708
  if (in_gimple_form)
Lines 2708-2714 non_lvalue (tree x) Link Here
2708
2710
2709
  if (! maybe_lvalue_p (x))
2711
  if (! maybe_lvalue_p (x))
2710
    return x;
2712
    return x;
2711
  return build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
2713
  ret = build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
2714
  TREE_NO_WARNING (ret) = TREE_NO_WARNING (x);
2715
  return ret;
2712
}
2716
}
2713
2717
2714
/* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
2718
/* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
(-)gcc/c-typeck.c.jj (+37 lines)
Lines 3124-3129 build_unary_op (enum tree_code code, tre Link Here
3124
3124
3125
	if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
3125
	if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
3126
	  val = boolean_increment (code, arg);
3126
	  val = boolean_increment (code, arg);
3127
	else if (INTEGRAL_TYPE_P (argtype)
3128
		 && c_promoting_integer_type_p (argtype))
3129
	  {
3130
	    tree promoted;
3131
	    tree newval;
3132
3133
	    arg = stabilize_reference (arg);
3134
	    promoted = (noconvert ? arg : default_conversion (arg));
3135
	    argtype = TREE_TYPE (promoted);
3136
	    inc = convert (argtype, inc);
3137
	    newval = build_binary_op (((code == PREINCREMENT_EXPR
3138
					|| code == POSTINCREMENT_EXPR)
3139
				       ? PLUS_EXPR
3140
				       : MINUS_EXPR),
3141
				      promoted, inc, 0);
3142
	    newval = convert (TREE_TYPE (arg), newval);
3143
	    switch (code)
3144
	      {
3145
	      case PREINCREMENT_EXPR:
3146
	      case PREDECREMENT_EXPR:
3147
		val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, newval);
3148
		break;
3149
3150
	      case POSTINCREMENT_EXPR:
3151
	      case POSTDECREMENT_EXPR:
3152
		val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, newval);
3153
		arg = save_expr (arg);
3154
		val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
3155
		TREE_NO_WARNING (val) = 1;
3156
		val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
3157
		TREE_NO_WARNING (val) = 1;
3158
		break;
3159
3160
	      default:
3161
		gcc_unreachable ();
3162
	      }
3163
	  }
3127
	else
3164
	else
3128
	  val = build2 (code, TREE_TYPE (arg), arg, inc);
3165
	  val = build2 (code, TREE_TYPE (arg), arg, inc);
3129
	TREE_SIDE_EFFECTS (val) = 1;
3166
	TREE_SIDE_EFFECTS (val) = 1;
(-)gcc/c-parser.c.jj (-2 / +90 lines)
Lines 7386-7395 c_parser_omp_atomic (c_parser *parser) Link Here
7386
  tree lhs, rhs;
7386
  tree lhs, rhs;
7387
  tree stmt;
7387
  tree stmt;
7388
  enum tree_code code;
7388
  enum tree_code code;
7389
  struct c_expr rhs_expr;
7389
  struct c_expr op, rhs_expr;
7390
7390
7391
  c_parser_skip_to_pragma_eol (parser);
7391
  c_parser_skip_to_pragma_eol (parser);
7392
7392
7393
  switch (c_parser_peek_token (parser)->type)
7394
    {
7395
    case CPP_PLUS_PLUS:
7396
    case CPP_MINUS_MINUS:
7397
      code = c_parser_peek_token (parser)->type == CPP_PLUS_PLUS
7398
	     ? PLUS_EXPR : MINUS_EXPR;
7399
      c_parser_consume_token (parser);
7400
      op = c_parser_cast_expression (parser, NULL);
7401
      op = default_function_array_conversion (op);
7402
      lhs = op.value;
7403
      if (parser_build_unary_op (code == PLUS_EXPR
7404
				 ? PREINCREMENT_EXPR
7405
				 : PREDECREMENT_EXPR, op).value
7406
	  == error_mark_node)
7407
	lhs = error_mark_node;
7408
      rhs = integer_one_node;
7409
      stmt = c_finish_omp_atomic (code, lhs, rhs);
7410
      if (stmt != error_mark_node)
7411
	add_stmt (stmt);
7412
      c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
7413
      return;
7414
    default:
7415
      break;
7416
    }
7417
7393
  lhs = c_parser_unary_expression (parser).value;
7418
  lhs = c_parser_unary_expression (parser).value;
7394
  switch (TREE_CODE (lhs))
7419
  switch (TREE_CODE (lhs))
7395
    {
7420
    {
Lines 7585-7591 c_parser_omp_for_loop (c_parser *parser) Link Here
7585
  /* Parse the increment expression.  */
7610
  /* Parse the increment expression.  */
7586
  incr = NULL_TREE;
7611
  incr = NULL_TREE;
7587
  if (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN))
7612
  if (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN))
7588
    incr = c_process_expr_stmt (c_parser_expression (parser).value);
7613
    {
7614
      struct c_expr op;
7615
      enum tree_code code;
7616
7617
      switch (c_parser_peek_token (parser)->type)
7618
	{
7619
	case CPP_PLUS_PLUS:
7620
	case CPP_MINUS_MINUS:
7621
	  code = c_parser_next_token_is (parser, CPP_PLUS_PLUS)
7622
		 ? PREINCREMENT_EXPR : PREDECREMENT_EXPR;
7623
	  c_parser_consume_token (parser);
7624
	  op = c_parser_cast_expression (parser, NULL);
7625
	  op = default_function_array_conversion (op);
7626
	  if (parser_build_unary_op (code, op).value == error_mark_node)
7627
	    incr = error_mark_node;
7628
	  else
7629
	    incr = build2 (MODIFY_EXPR, TREE_TYPE (op.value), op.value,
7630
			   build2 (code == PREINCREMENT_EXPR
7631
				   ? PLUS_EXPR : MINUS_EXPR,
7632
				   TREE_TYPE (op.value), op.value,
7633
				   build_int_cst (TREE_TYPE (op.value), 1)));
7634
	  break;
7635
	case CPP_NAME:
7636
	  if (c_parser_peek_2nd_token (parser)->type == CPP_PLUS_PLUS
7637
	      || c_parser_peek_2nd_token (parser)->type == CPP_MINUS_MINUS)
7638
	    {
7639
	      code = c_parser_peek_2nd_token (parser)->type == CPP_PLUS_PLUS
7640
		     ? POSTINCREMENT_EXPR : POSTDECREMENT_EXPR;
7641
	      if (c_parser_peek_token (parser)->id_kind != C_ID_ID)
7642
		{
7643
		  c_parser_error (parser, "expected expression");
7644
		  op.value = error_mark_node;
7645
		  op.original_code = ERROR_MARK;
7646
		}
7647
	      else
7648
		{
7649
		  tree id = c_parser_peek_token (parser)->value;
7650
		  location_t loc = c_parser_peek_token (parser)->location;
7651
		  c_parser_consume_token (parser);
7652
		  op.value = build_external_ref (id, 0, loc);
7653
		  op.original_code = ERROR_MARK;
7654
		  op = default_function_array_conversion (op);
7655
		  gcc_assert (c_parser_next_token_is
7656
				(parser, code == POSTINCREMENT_EXPR
7657
					 ? CPP_PLUS_PLUS : CPP_MINUS_MINUS));
7658
		  c_parser_consume_token (parser);
7659
		}
7660
	      if (parser_build_unary_op (code, op).value == error_mark_node)
7661
		incr = error_mark_node;
7662
	      else
7663
		incr = build2 (MODIFY_EXPR, TREE_TYPE (op.value), op.value,
7664
			       build2 (code == POSTINCREMENT_EXPR
7665
				       ? PLUS_EXPR : MINUS_EXPR,
7666
				       TREE_TYPE (op.value), op.value,
7667
				       build_int_cst (TREE_TYPE (op.value),
7668
						      1)));
7669
	      break;
7670
	    }
7671
	  /* FALLTHROUGH */
7672
	default:
7673
	  incr = c_parser_expression (parser).value;
7674
	}
7675
      incr = c_process_expr_stmt (incr);
7676
    }
7589
  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
7677
  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
7590
7678
7591
 parse_body:
7679
 parse_body:

Return to bug 35634