On Fri, Mar 27, 2020 at 09:09:42PM +0100, Richard Biener wrote: > Sounds worth a try.
Unfortunately that FAILed miserably: +FAIL: g++.dg/cpp0x/constexpr-object1.C -std=c++11 (test for excess errors) +FAIL: g++.dg/cpp0x/constexpr-object1.C -std=c++14 (test for excess errors) +FAIL: g++.dg/cpp0x/constexpr-rom.C -std=c++11 scan-assembler rodata +FAIL: g++.dg/cpp0x/constexpr-rom.C -std=c++14 scan-assembler rodata +FAIL: g++.dg/cpp0x/constexpr-rom.C -std=c++17 scan-assembler rodata +FAIL: g++.dg/cpp0x/constexpr-rom.C -std=c++2a scan-assembler rodata +FAIL: g++.dg/cpp0x/constexpr-static.C -std=gnu++11 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static.C -std=gnu++14 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static.C -std=gnu++17 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static.C -std=gnu++2a scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static3.C -std=gnu++11 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static3.C -std=gnu++14 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static3.C -std=gnu++17 scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/constexpr-static3.C -std=gnu++2a scan-assembler-not static_initialization +FAIL: g++.dg/cpp0x/pr78765.C -std=c++11 (test for excess errors) +FAIL: g++.dg/cpp0x/pr78765.C -std=c++14 (test for excess errors) +FAIL: g++.dg/cpp0x/pr78765.C -std=c++17 (test for excess errors) +FAIL: g++.dg/cpp0x/pr78765.C -std=c++2a (test for excess errors) +FAIL: g++.dg/cpp1y/constexpr-empty3.C -std=c++14 scan-assembler-not static_init +FAIL: g++.dg/cpp1y/constexpr-empty3.C -std=c++17 scan-assembler-not static_init +FAIL: g++.dg/cpp1y/constexpr-empty3.C -std=c++2a scan-assembler-not static_init +FAIL: g++.dg/cpp1z/decomp3.C (test for excess errors) +FAIL: g++.dg/cpp1z/elide2.C -std=c++11 execution test +FAIL: g++.dg/cpp1z/elide2.C -std=c++14 execution test +FAIL: g++.dg/cpp1z/elide2.C -std=c++17 execution test +FAIL: g++.dg/cpp1z/elide2.C -std=c++2a execution test +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++11 (test for errors, line 6) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++11 (test for excess errors) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++14 (test for errors, line 6) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++14 (test for excess errors) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++17 (test for errors, line 6) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++17 (test for excess errors) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++2a (test for errors, line 6) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++2a (test for excess errors) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++98 (test for errors, line 6) +FAIL: g++.dg/ext/stmtexpr15.C -std=gnu++98 (test for excess errors) +FAIL: g++.dg/other/error19.C -std=c++11 (test for excess errors) +FAIL: g++.dg/other/error19.C -std=c++14 (test for excess errors) +FAIL: g++.dg/other/error19.C -std=c++17 (test for excess errors) +FAIL: g++.dg/other/error19.C -std=c++2a (test for excess errors) +FAIL: g++.dg/other/error19.C -std=c++98 (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++11 (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++11 17 (test for errors, line 6) +FAIL: g++.dg/parse/error26.C -std=gnu++14 (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++14 17 (test for errors, line 6) +FAIL: g++.dg/parse/error26.C -std=gnu++17 (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++17 17 (test for errors, line 6) +FAIL: g++.dg/parse/error26.C -std=gnu++2a (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++2a 17 (test for errors, line 6) +FAIL: g++.dg/parse/error26.C -std=gnu++98 (test for excess errors) +FAIL: g++.dg/parse/error26.C -std=gnu++98 17 (test for errors, line 6) +FAIL: g++.dg/tree-ssa/pr69336.C (test for excess errors) +UNRESOLVED: g++.dg/tree-ssa/pr69336.C scan-tree-dump-not optimized "cmap" +FAIL: g++.dg/torture/pr45709-2.C -O1 (internal compiler error) +FAIL: g++.dg/torture/pr45709-2.C -O1 (test for excess errors) +FAIL: g++.dg/torture/pr45709-2.C -O2 (internal compiler error) +FAIL: g++.dg/torture/pr45709-2.C -O2 (test for excess errors) +FAIL: g++.dg/torture/pr45709-2.C -O2 -flto (internal compiler error) +FAIL: g++.dg/torture/pr45709-2.C -O2 -flto (test for excess errors) +FAIL: g++.dg/torture/pr45709-2.C -O2 -flto -flto-partition=none (internal compiler error) +FAIL: g++.dg/torture/pr45709-2.C -O2 -flto -flto-partition=none (test for excess errors) +FAIL: g++.dg/torture/pr45709-2.C -O3 -g (internal compiler error) +FAIL: g++.dg/torture/pr45709-2.C -O3 -g (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -O1 (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -O1 (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -O2 (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -O2 (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -O2 -flto (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -O2 -flto (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -O2 -flto -flto-partition=none (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -O2 -flto -flto-partition=none (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -O3 -g (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -O3 -g (test for excess errors) +FAIL: g++.dg/torture/pr45709.C -Os (internal compiler error) +FAIL: g++.dg/torture/pr45709.C -Os (test for excess errors) +FAIL: libgomp.c++/ctor-5.C (test for excess errors) +UNRESOLVED: libgomp.c++/ctor-5.C compilation failed to produce executable 2020-03-27 Jakub Jelinek <ja...@redhat.com> PR middle-end/93786 PR debug/94340 * semantics.c (finish_stmt_expr): Force retainment of a STATEMENT_LIST with TREE_SIDE_EFFECTS set on a statement expression. * g++.dg/other/pr93786.C: New test. * g++.dg/other/pr94340.C: New test. --- gcc/cp/semantics.c.jj 2020-02-05 23:34:33.341851494 +0100 +++ gcc/cp/semantics.c 2020-03-27 17:02:27.494528113 +0100 @@ -2319,7 +2319,13 @@ finish_stmt_expr (tree stmt_expr, bool h gcc_assert (TREE_CODE (stmt_expr) == STATEMENT_LIST); type = TREE_TYPE (stmt_expr); + /* For statement-expressions, force the STATEMENT_LIST + to be preserved with side-effects, even if it contains + just one statement or no statements. See PR93786. */ + TREE_SIDE_EFFECTS (stmt_expr) = 0; result = pop_stmt_list (stmt_expr); + gcc_assert (result == stmt_expr); + TREE_SIDE_EFFECTS (result) = 1; TREE_TYPE (result) = type; if (processing_template_decl) --- gcc/testsuite/g++.dg/other/pr93786.C.jj 2020-03-27 17:10:51.337993640 +0100 +++ gcc/testsuite/g++.dg/other/pr93786.C 2020-02-25 13:46:08.209039387 +0100 @@ -0,0 +1,11 @@ +// PR middle-end/93786 +// { dg-do compile } +// { dg-options "-O2 -fcompare-debug" } + +struct S { virtual void bar (); }; + +void +foo (S *s) +{ + ({ s; })->bar (); +} --- gcc/testsuite/g++.dg/other/pr94340.C.jj 2020-03-27 17:13:15.859832404 +0100 +++ gcc/testsuite/g++.dg/other/pr94340.C 2020-03-27 17:14:26.043782842 +0100 @@ -0,0 +1,16 @@ +// PR debug/94340 +// { dg-do compile } +// { dg-options "-O -fcompare-debug" } + +struct D { int i; D (); ~D (); }; +D foo (); + +void +bar (void) +{ + if ( + ({ + foo (); + }).i) + return; +} Jakub