https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122237
Bug ID: 122237
Summary: ICE: tree check: expected tree_list, have error_mark
in handle_access_attribute, at
c-family/c-attribs.cc:5587
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qingren2hxb at gmail dot com
Target Milestone: ---
Created attachment 62533
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62533&action=edit
bug report by using -freport-bug
*******************************************************************************
# gcc -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/gcc
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
*******************************************************************************
$ g++ -
template<typename T>
struct S {
__attribute__((access(read_write, 1, T::X)))
void corrupt(char* p) {
p[T::X - 1] = 0;
}
};
void trigger() {
S<int> s;
}
*******************************************************************************
In instantiation of 'struct S<int>':
test.C:10:10: required from here
10 | S<int> s;
| ^
test.C:3:43: error: 'X' is not a member of 'int'
3 | __attribute__((access(read_write, 1, T::X)))
| ^
test.C:4:8: internal compiler error: tree check: expected tree_list, have
error_mark in handle_access_attribute, at c-family/c-attribs.cc:5587
4 | void corrupt(char* p) {
| ^~~~~~~
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x2edb710 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/workspace/gcc/gcc/tree.cc:9114
0xec313c tree_check(tree_node*, char const*, int, char const*, tree_code)
/workspace/gcc/gcc/tree.h:3692
0x18a4d9f handle_access_attribute
/workspace/gcc/gcc/c-family/c-attribs.cc:5587
0x173776b decl_attributes(tree_node**, tree_node*, int, tree_node*)
/workspace/gcc/gcc/attribs.cc:904
0x1170568 cplus_decl_attributes(tree_node**, tree_node*, int)
/workspace/gcc/gcc/cp/decl2.cc:1988
0x1508fef apply_late_template_attributes
/workspace/gcc/gcc/cp/pt.cc:12435
0x1523051 tsubst_function_decl
/workspace/gcc/gcc/cp/pt.cc:15005
0x152ad0f tsubst_decl
/workspace/gcc/gcc/cp/pt.cc:15395
0x15328a5 tsubst(tree_node*, tree_node*, int, tree_node*)
/workspace/gcc/gcc/cp/pt.cc:16443
0x150cae4 instantiate_class_template(tree_node*)
/workspace/gcc/gcc/cp/pt.cc:12738
0x16c0df7 complete_type(tree_node*)
/workspace/gcc/gcc/cp/typeck.cc:138
0x10e6cb0 start_decl_1(tree_node*, bool)
/workspace/gcc/gcc/cp/decl.cc:6258
0x10e68b4 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
/workspace/gcc/gcc/cp/decl.cc:6224
0x13f562b cp_parser_init_declarator
/workspace/gcc/gcc/cp/parser.cc:24147
0x13d7ba7 cp_parser_simple_declaration
/workspace/gcc/gcc/cp/parser.cc:16528
0x13d731e cp_parser_block_declaration
/workspace/gcc/gcc/cp/parser.cc:16347
0x13d349b cp_parser_declaration_statement
/workspace/gcc/gcc/cp/parser.cc:15444
0x13c977c cp_parser_statement
/workspace/gcc/gcc/cp/parser.cc:13285
0x13cbd30 cp_parser_statement_seq_opt
/workspace/gcc/gcc/cp/parser.cc:13859
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.