[Bug c++/78897] [6/7 Regression] ICE: in output_constructor_regular_field, at varasm.c:5019

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 22 09:24:00 GMT 2016


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

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Please notice that I've reduced this from a ICE on invalid posted on Reddit:

markus@x4 /tmp % cat const.ii
constexpr void *operator new(long unsigned int, void *where) { return where; }

class Optional {
public:
  explicit constexpr Optional() : _value{0} {}

  constexpr Optional(const Optional &o) : _dummy{0} {
    new (&this->_value) int(o._value);
  }

private:
  union {

    char _dummy;
    int _value;
  };
};

int main() {
  constexpr Optional opt1{};
  constexpr Optional opt2{opt1};
}

markus@x4 /tmp % g++ const.ii
const.ii: In function ‘int main()’:
const.ii:21:22: internal compiler error: in complete_ctor_at_level_p, at
expr.c:6022
   constexpr Optional opt2{opt1};
                      ^~~~
0xa2db7d complete_ctor_at_level_p(tree_node const*, long, tree_node const*)
        /home/markus/gcc/gcc/expr.c:6022
0xa2df01 categorize_ctor_elements_1
        /home/markus/gcc/gcc/expr.c:5973
0xa2ddd0 categorize_ctor_elements_1
        /home/markus/gcc/gcc/expr.c:5911
0xaefbcc gimplify_init_constructor
        /home/markus/gcc/gcc/gimplify.c:4622
0xaf1216 gimplify_modify_expr_rhs
        /home/markus/gcc/gcc/gimplify.c:5063
0xaf7f89 gimplify_modify_expr
        /home/markus/gcc/gcc/gimplify.c:5399
0xae65e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/markus/gcc/gcc/gimplify.c:11185
0xae9b18 gimplify_stmt(tree_node**, gimple**)
        /home/markus/gcc/gcc/gimplify.c:6460
0xaf5ba0 gimplify_and_add(tree_node*, gimple**)
        /home/markus/gcc/gcc/gimplify.c:435
0xaf5ba0 gimplify_decl_expr
        /home/markus/gcc/gcc/gimplify.c:1651
0xae656a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/markus/gcc/gcc/gimplify.c:11380
0xae9b18 gimplify_stmt(tree_node**, gimple**)
        /home/markus/gcc/gcc/gimplify.c:6460
0xae5778 gimplify_cleanup_point_expr
        /home/markus/gcc/gcc/gimplify.c:6211
0xae5778 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/markus/gcc/gcc/gimplify.c:11560
0xae9b18 gimplify_stmt(tree_node**, gimple**)
        /home/markus/gcc/gcc/gimplify.c:6460
0xae6d6b gimplify_statement_list
        /home/markus/gcc/gcc/gimplify.c:1704
0xae6d6b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/markus/gcc/gcc/gimplify.c:11612
0xae9b18 gimplify_stmt(tree_node**, gimple**)
        /home/markus/gcc/gcc/gimplify.c:6460
0xaeace5 gimplify_bind_expr
        /home/markus/gcc/gcc/gimplify.c:1277
0xae587a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/markus/gcc/gcc/gimplify.c:11384

Not sure if this is cased by the same underlying bug.


More information about the Gcc-bugs mailing list