2017-12-22 Jakub Jelinek <jakub@redhat.com>
+ PR debug/83547
+ * tree-iterator.c (alloc_stmt_list): Start with cleared
+ TREE_SIDE_EFFECTS regardless whether a new STATEMENT_LIST is allocated
+ or old one reused.
+
PR target/83488
* config/i386/avx512vnniintrin.h: Don't check for __AVX512F__ nor
enable avx512f explicitly in #pragma GCC target.
+2017-12-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83547
+ * c-typeck.c (c_finish_stmt_expr): Ignore !TREE_SIDE_EFFECTS as
+ indicator of ({ }), instead skip all trailing DEBUG_BEGIN_STMTs first,
+ and consider empty ones if there are no other stmts. For
+ -Wunused-value walk all statements before the one only followed by
+ DEBUG_BEGIN_STMTs.
+
2017-12-22 Mike Stump <mikestump@comcast.net>
Eric Botcazou <ebotcazou@adacore.com>
continue_searching:
if (TREE_CODE (last) == STATEMENT_LIST)
{
- tree_stmt_iterator i;
+ tree_stmt_iterator l = tsi_last (last);
+
+ while (!tsi_end_p (l) && TREE_CODE (tsi_stmt (l)) == DEBUG_BEGIN_STMT)
+ tsi_prev (&l);
/* This can happen with degenerate cases like ({ }). No value. */
- if (!TREE_SIDE_EFFECTS (last))
+ if (tsi_end_p (l))
return body;
/* If we're supposed to generate side effects warnings, process
all of the statements except the last. */
if (warn_unused_value)
{
- for (i = tsi_start (last); !tsi_one_before_end_p (i); tsi_next (&i))
+ for (tree_stmt_iterator i = tsi_start (last);
+ tsi_stmt (i) != tsi_stmt (l); tsi_next (&i))
{
location_t tloc;
tree t = tsi_stmt (i);
emit_side_effect_warnings (tloc, t);
}
}
- else
- i = tsi_last (last);
- if (TREE_CODE (tsi_stmt (i)) == DEBUG_BEGIN_STMT)
- do
- tsi_prev (&i);
- while (TREE_CODE (tsi_stmt (i)) == DEBUG_BEGIN_STMT);
- last_p = tsi_stmt_ptr (i);
+ last_p = tsi_stmt_ptr (l);
last = *last_p;
}
2017-12-22 Jakub Jelinek <jakub@redhat.com>
+ PR debug/83547
+ * gcc.c-torture/compile/pr83547.c: New test.
+
PR target/83488
* gcc.target/i386/pr83488-2.c: New test.
* gcc.target/i386/pr83488-3.c: New test.
--- /dev/null
+/* PR debug/83547 */
+
+void
+foo (void)
+{
+ if (({ 0; }))
+ ;
+ if (({ 0; 0; }))
+ ;
+ if (({ })) /* { dg-error "void value not ignored as it ought to be" } */
+ ;
+ if (({ 0; { 0; } })) /* { dg-error "void value not ignored as it ought to be" } */
+ ;
+ if (({ 0; {} })) /* { dg-error "void value not ignored as it ought to be" } */
+ ;
+}
TREE_SET_CODE (list, STATEMENT_LIST);
}
else
- list = make_node (STATEMENT_LIST);
+ {
+ list = make_node (STATEMENT_LIST);
+ TREE_SIDE_EFFECTS (list) = 0;
+ }
TREE_TYPE (list) = void_type_node;
return list;
}