https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87541
Bug ID: 87541 Summary: ICE using a constant decl as an attribute alloc_size argument Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Similar to bug 79984, using a named constant in an alloc_size argument causes an ICE in C++. $ cat x.c && gcc -S -Wall x.c const int r = 1; __attribute__ ((alloc_size (r))) void* f (int); void* g (void) { void *p = f (1); __builtin___memset_chk (p, 0, 1, __builtin_object_size (p, 1)); return p; } during RTL pass: expand x.c: In function ‘void* g()’: x.c:7:15: internal compiler error: tree check: expected integer_cst, have var_decl in initialize_argument_information, at calls.c:2059 void *p = f (1); ~~^~~ 0x15f600e tree_check_failed(tree_node const*, char const*, int, char const*, ...) /src/gcc/8-branch/gcc/tree.c:9333 0x81ca71 tree_int_cst_elt_check(tree_node*, int, char const*, int, char const*) /src/gcc/8-branch/gcc/tree.h:3335 0xc03e68 initialize_argument_information /src/gcc/8-branch/gcc/calls.c:2059 0xc0a4f4 expand_call(tree_node*, rtx_def*, int) /src/gcc/8-branch/gcc/calls.c:3723 0xdc9f69 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/8-branch/gcc/expr.c:11008 0xdbca98 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/8-branch/gcc/expr.c:8233 0xdb1e8a store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool, tree_node*) /src/gcc/8-branch/gcc/expr.c:5635 0xdb03d4 expand_assignment(tree_node*, tree_node*, bool) /src/gcc/8-branch/gcc/expr.c:5403 0xc274b7 expand_call_stmt /src/gcc/8-branch/gcc/cfgexpand.c:2688 0xc2a7a8 expand_gimple_stmt_1 /src/gcc/8-branch/gcc/cfgexpand.c:3624 0xc2ae82 expand_gimple_stmt /src/gcc/8-branch/gcc/cfgexpand.c:3790 0xc32f95 expand_gimple_basic_block /src/gcc/8-branch/gcc/cfgexpand.c:5819 0xc348ee execute /src/gcc/8-branch/gcc/cfgexpand.c:6425 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.