Bug 83547 - [8 Regression] (statement-frontiers) error: void value not ignored as it ought to be
Summary: [8 Regression] (statement-frontiers) error: void value not ignored as it ough...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Jakub Jelinek
URL:
Keywords: rejects-valid
: 83539 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-22 07:12 UTC by Markus Trippelsdorf
Modified: 2017-12-22 18:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-12-22 00:00:00


Attachments
gcc8-pr83547.patch (1.18 KB, patch)
2017-12-22 11:44 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2017-12-22 07:12:16 UTC
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; }))
       ^
Comment 1 Jakub Jelinek 2017-12-22 11:44:04 UTC
Created attachment 42951 [details]
gcc8-pr83547.patch

Untested fix.
Comment 2 Andreas Schwab 2017-12-22 13:37:00 UTC
*** Bug 83539 has been marked as a duplicate of this bug. ***
Comment 3 Jakub Jelinek 2017-12-22 18:02:29 UTC
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
Comment 4 Jakub Jelinek 2017-12-22 18:12:58 UTC
Fixed.