aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-12-15 15:13:49 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-12-15 15:13:49 +0000
commit2994fb91b7df8f8a0c0f83024c240f25f78f25a0 (patch)
tree4754cc1722a0b8dfa443bdb17e5fb5e5f5efc61d
parent4a38b02b4ed0b6d58e1773072daff795eb244829 (diff)
downloadgcc-2994fb91b7df8f8a0c0f83024c240f25f78f25a0.zip
gcc-2994fb91b7df8f8a0c0f83024c240f25f78f25a0.tar.gz
gcc-2994fb91b7df8f8a0c0f83024c240f25f78f25a0.tar.bz2
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
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr68907.c14
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2ba9464..e61a2ed 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -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
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index b691072..9d6c604 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 633f8b2..17c1b66 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..de1c237
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr68907.c
@@ -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--;
+}