https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119582
Bug ID: 119582
Summary: ICE in gimplify_expr, at gimplify.cc:18708 with
-fsanitize=pointer-subtract
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: cmbugz at sent dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
Target Milestone: ---
I triggered an ICE while compiling diffutils with sanitizer flags:
ice.c:
const char linbuf;
void print_ifdef_lines() {
char buf_0;
&buf_0 + (linbuf != '\n') - &buf_0;
}
gcc -fsanitize=address -fsanitize=pointer-subtract ice.c
ice.c: In function ‘print_ifdef_lines’:
ice.c:4:20: internal compiler error: in gimplify_expr, at gimplify.cc:18708
4 | &buf_0 + (linbuf != '\n') - &buf_0;
| ~~~~~~~~^~~~~~~~
0x1f93416 internal_error(char const*, ...)
???:0
0x6d8253 fancy_abort(char const*, int, char const*)
???:0
0xa6861a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa686e7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa69786 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa42f86 gimplify_arg(tree_node**, gimple**, unsigned int, bool)
???:0
0xa6a70e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa6a828 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa68d45 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa69741 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xa764db gimplify_body(tree_node*, bool)
???:0
0xa7699a gimplify_function_tree(tree_node*)
???:0
0x8a9b9b cgraph_node::analyze()
???:0
0x8ae0f9 symbol_table::finalize_compilation_unit()
???:0
Version info:
gcc (GCC) 14.2.1 20250207 on Arch Linux
I also tested "x86-64 gcc (trunk)" on Compiler Explorer and saw the same ICE.