While the PR is about an ICE during debug stmt expansion it shows a missed optimization ultimatively leading to a debug stmt refering to VIEW_CONVERT_EXPR<int>({}) which isn't handled.
The following fixes the missed optimization and thus also the ICE by instead producing a debug stmt refering to 0. Bootstrap / regtest running on x86_64-unknown-linux-gnu. OK for GCC 9? The ICE would be a checking-only ICE. Richard. 2019-04-24 Richard Biener <rguent...@suse.de> PR middle-end/90194 * match.pd: Add pattern to simplify view-conversion of an empty constructor. * g++.dg/torture/pr90194.C: New testcase. Index: gcc/match.pd =================================================================== --- gcc/match.pd (revision 270537) +++ gcc/match.pd (working copy) @@ -2596,6 +2596,13 @@ (define_operator_list COND_TERNARY && 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 Index: gcc/testsuite/g++.dg/torture/pr90194.C =================================================================== --- gcc/testsuite/g++.dg/torture/pr90194.C (nonexistent) +++ gcc/testsuite/g++.dg/torture/pr90194.C (working copy) @@ -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 { }; +}