https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90194

            Bug ID: 90194
           Summary: ICE in expand_debug_expr, at cfgexpand.c:5244
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: ice-checking
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-9.0.0-alpha20190407 snapshot (r270192) ICEs when compiling the following
testcase at any optimization level (except -Og) and w/ -g:

struct cb {
  int yr;
};

void *
operator new (__SIZE_TYPE__, void *nq)
{
  return nq;
}

void
af (int xn)
{
  new (&xn) cb { };
}

% g++-9.0.0-alpha20190407 -O1 -g -c vquxpovp.cc
 <constructor 0x7fd5336356d8
    type <record_type 0x7fd53360e690 cb asm_written type_5 type_6 SI
        size <integer_cst 0x7fd5334d9078 constant 32>
        unit-size <integer_cst 0x7fd5334d9090 constant 4>
        align:32 warn_if_not_align:0 symtab:860696976 alias-set 1
canonical-type 0x7fd53360e690
        fields <function_decl 0x7fd533613f00 __dt  type <method_type
0x7fd533628738>
            public abstract external autoinline decl_3 QI vquxpovp.cc:1:8
align:16 warn_if_not_align:0 context <record_type 0x7fd53360e690 cb>
            full-name "cb::~cb() noexcept (<uninstantiated>)"
            not-really-extern chain <function_decl 0x7fd533629100 __dt_base >>
context <translation_unit_decl 0x7fd5334c4168 vquxpovp.cc>
        full-name "struct cb"
        X() X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown
        pointer_to_this <pointer_type 0x7fd53360ebd0> reference_to_this
<reference_type 0x7fd5336282a0> chain <type_decl 0x7fd5335da688 cb>>
    constant static tree_0 length:0>
during RTL pass: expand
vquxpovp.cc: In function 'void af(int)':
vquxpovp.cc:12:1: internal compiler error: in expand_debug_expr, at
cfgexpand.c:5244
   12 | af (int xn)
      | ^~
0xb29d93 expand_debug_expr
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/cfgexpand.c:5244
0xb2a044 expand_debug_expr
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/cfgexpand.c:4560
0xb359e3 expand_debug_locations
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/cfgexpand.c:5442
0xb359e3 execute
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/cfgexpand.c:6512

g++ 8.3, 7.4, 6.3 fail differently:

% g++-8.3.0 -O1 -fchecking -g -c vquxpovp.cc
vquxpovp.cc: In function 'void af(int)':
vquxpovp.cc:12:1: error: invalid reference prefix
 af (int xn)
 ^~
{}
vquxpovp.cc:14:3: note: in statement
   new (&xn) cb { };
   ^~~~~~~~~~~~~~~~
xn_5 = VIEW_CONVERT_EXPR<int>({});
vquxpovp.cc:12: confused by earlier errors, bailing out

Reply via email to