re PR c/68907 (bogus warning: right-hand operand of comma expression has no effect on an atomic_int preincrement)

PR c/68907
	* c-typeck.c (build_atomic_assign): Set TREE_NO_WARNING on an
	artificial decl.

	* gcc.dg/pr68907.c: New test.

From-SVN: r231656
This commit is contained in:
Marek Polacek 2015-12-15 15:13:49 +00:00 committed by Marek Polacek
parent 4a38b02b4e
commit 2994fb91b7
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2015-12-15 Marek Polacek <polacek@redhat.com>
PR c/68907
* c-typeck.c (build_atomic_assign): Set TREE_NO_WARNING on an
artificial decl.
2015-12-08 David Malcolm <dmalcolm@redhat.com>
* c-parser.c (c_parser_alignof_expression): Capture location of

View File

@ -3814,6 +3814,7 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode,
newval = create_tmp_var_raw (nonatomic_lhs_type);
newval_addr = build_unary_op (loc, ADDR_EXPR, newval, 0);
TREE_ADDRESSABLE (newval) = 1;
TREE_NO_WARNING (newval) = 1;
loop_decl = create_artificial_label (loc);
loop_label = build1 (LABEL_EXPR, void_type_node, loop_decl);

View File

@ -1,3 +1,8 @@
2015-12-15 Marek Polacek <polacek@redhat.com>
PR c/68907
* gcc.dg/pr68907.c: New test.
2015-12-15 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray_critical_1.f90: New.

View File

@ -0,0 +1,14 @@
/* PR c/60195 */
/* { dg-do compile } */
/* { dg-options "-std=c11 -Wpedantic -Wall" } */
_Atomic int a;
void
fn (void)
{
++a;
a++;
--a;
a--;
}