re PR c/68907 (bogus warning: right-hand operand of comma expression has no effect...
authorMarek Polacek <polacek@redhat.com>
Tue, 15 Dec 2015 15:13:49 +0000 (15:13 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 15 Dec 2015 15:13:49 +0000 (15:13 +0000)
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

gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr68907.c [new file with mode: 0644]

index 2ba94646e646af97a44c6c97aeb1c1b1bb781c2f..e61a2edd2b3e0ed6c2e7df4c37ce42b9005741f4 100644 (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
index b691072caa932c4fd60c771065e8dc1824eddfb1..9d6c604ed909baa1c958f252f7a0bc595dab5ba9 100644 (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);
index 633f8b2afe5b90dffbf9b325e2487ae41f0d359c..17c1b661e198ae2e20b8b59bb6f73dfee21bf3a8 100644 (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.
diff --git a/gcc/testsuite/gcc.dg/pr68907.c b/gcc/testsuite/gcc.dg/pr68907.c
new file mode 100644 (file)
index 0000000..de1c237
--- /dev/null
@@ -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--;
+}