From f469220df6185dee831686631c570245769887da Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 25 Apr 2019 11:15:35 +0000 Subject: [PATCH] re PR middle-end/90194 (ICE in expand_debug_expr, at cfgexpand.c:5244) 2019-04-25 Richard Biener PR middle-end/90194 * match.pd: Add pattern to simplify view-conversion of an empty constructor. * g++.dg/torture/pr90194.C: New testcase. From-SVN: r270569 --- gcc/ChangeLog | 6 ++++++ gcc/match.pd | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr90194.C | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr90194.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d4c5b31613c..2aeafe1d30c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-25 Richard Biener + + PR middle-end/90194 + * match.pd: Add pattern to simplify view-conversion of an + empty constructor. + 2019-04-24 Clement Chigot * config/rs6000/aix71.h (SUBTARGET_OVERRIDE_OPTIONS): Disable diff --git a/gcc/match.pd b/gcc/match.pd index 0d82beab45b..039ddacfed1 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2596,6 +2596,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && TYPE_UNSIGNED (TREE_TYPE (@1))))) (view_convert @1))) +/* Simplify a view-converted empty constructor. */ +(simplify + (view_convert CONSTRUCTOR@0) + (if (TREE_CODE (@0) != SSA_NAME + && CONSTRUCTOR_NELTS (@0) == 0) + { build_zero_cst (type); })) + /* Re-association barriers around constants and other re-association barriers can be removed. */ (simplify diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 115c22088ef..f1291f11c52 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-25 Richard Biener + + PR middle-end/90194 + * g++.dg/torture/pr90194.C: New testcase. + 2019-04-24 Marek Polacek PR c++/90236 diff --git a/gcc/testsuite/g++.dg/torture/pr90194.C b/gcc/testsuite/g++.dg/torture/pr90194.C new file mode 100644 index 00000000000..f0c3a77db8a --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr90194.C @@ -0,0 +1,18 @@ +// { dg-do compile } +// { dg-additional-options "-g" } + +struct cb { + int yr; +}; + +void * +operator new (__SIZE_TYPE__, void *nq) +{ + return nq; +} + +void +af (int xn) +{ + new (&xn) cb { }; +} -- 2.30.2