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

            Bug ID: 90199
           Summary: ICE: tree check: expected complex_cst, have plus_expr
                    in output_constant, at varasm.c:4994
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-9.0.0-alpha20190414 snapshot (r270355), 8.3, 7.4, 6.3 all ICE when
compiling the following testcase w/ -frounding-math:

template <typename>
class complex;

template <typename D7> constexpr complex<D7>
operator+ (complex<D7> hd, complex<D7> qc)
{
  hd += qc;
  return hd;
}

template <>
class complex<float> {
public:
  constexpr complex
  operator+= (complex rm)
  {
    jp += rm.jp;
    return *this;
  }

  _Complex float jp;
};

constexpr complex<float> fl{3.3}, ka{1.1}, r0 = fl + ka;

% g++-9.0.0-alpha20190414 -frounding-math -c cvzjr7ol.cc
cvzjr7ol.cc:24:56: internal compiler error: tree check: expected complex_cst,
have plus_expr in output_constant, at varasm.c:4994
   24 | constexpr complex<float> fl{3.3}, ka{1.1}, r0 = fl + ka;
      |                                                        ^
0x7b55c1 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/tree.c:9881
0x7cce74 tree_check(tree_node*, char const*, int, char const*, tree_code)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/tree.h:3176
0x7cce74 output_constant
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:4994
0x126c2bf output_constant
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:5246
0x126c2bf output_constructor_regular_field
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:5246
0x126c2bf output_constructor
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:5513
0x126d034 output_constant
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:4885
0x126d034 assemble_variable_contents
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:2144
0x1275ad4 assemble_variable(tree_node*, int, int, int)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varasm.c:2323
0x1278449 varpool_node::assemble_decl()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/varpool.c:584
0xb6b69c output_in_order
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cgraphunit.c:2446
0xb6b69c symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cgraphunit.c:2686
0xb6ddfc symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cgraphunit.c:2599
0xb6ddfc symbol_table::finalize_compilation_unit()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cgraphunit.c:2865

Reply via email to