https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102071
Bug ID: 102071 Summary: crash when combining -faligned-new=N with array cookie Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk Target Milestone: --- Testcase: struct X { ~X(); int c; }; extern int n; X *p = new X[n]; Compiling with -faligned-new=2 gives: <source>:3:15: internal compiler error: tree check: expected class 'vl_exp', have 'unary' (nop_expr) in stabilize_call, at cp/tree.c:5739 3 | X *p = new X[n]; | ^ 0x1f2c1d9 internal_error(char const*, ...) ???:0 0x6baa59 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ???:0 0xab0d8d stabilize_call(tree_node*, tree_node**) ???:0 0x8e0551 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**, tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int) ???:0 0x9cffc5 c_parse_file() ???:0 0xb55092 c_common_parse_file() ???:0 FWIW, for this example, Clang passes align_val_t{max(alignof(size_t), alignof(X))} as the alignment argument to ensure the cookie is suitably aligned.