trippels@gcc2-power8 linux % cat lpar.i void foo(void) { if (({ 0; })) ; } trippels@gcc2-power8 linux % gcc -O2 -c lpar.i trippels@gcc2-power8 linux % gcc -gno-statement-frontiers -O2 -g -c lpar.i trippels@gcc2-power8 linux % gcc -O2 -g -c lpar.i lpar.i: In function ‘foo’: lpar.i:2:7: error: void value not ignored as it ought to be if (({ 0; })) ^
Created attachment 42951 [details] gcc8-pr83547.patch Untested fix.
*** Bug 83539 has been marked as a duplicate of this bug. ***
Author: jakub Date: Fri Dec 22 18:01:58 2017 New Revision: 255980 URL: https://gcc.gnu.org/viewcvs?rev=255980&root=gcc&view=rev Log: 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. c/ * 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. testsuite/ * gcc.c-torture/compile/pr83547.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr83547.c Modified: trunk/gcc/ChangeLog trunk/gcc/c/ChangeLog trunk/gcc/c/c-typeck.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-iterator.c
Fixed.