https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110603
Bug ID: 110603 Summary: GCC, ICE: internal compiler error: in verify_range, at value-range.cc:1104 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- The testing program: ``` typedef long unsigned int size_t; void *memcpy(void *, const void *, size_t); int snprintf(char *restrict, size_t, const char *restrict, ...); extern char a[2]; void test_func_on_line_62(void) { memcpy(a, "12", sizeof("12") - 1); const int res = snprintf(0, 0, "%s", a); if (res <= 3) do { extern void f(void); f(); } while (0); } ``` When attempting to compile it with `gcc-14 -O2 small.c`, gcc-14 crashes: ``` during GIMPLE pass: strlen <source>: In function 'test_func_on_line_62': <source>:6:6: internal compiler error: in verify_range, at value-range.cc:1104 6 | void test_func_on_line_62(void) { | ^~~~~~~~~~~~~~~~~~~~ 0x213b0ee internal_error(char const*, ...) ???:0 0x9ca9f8 fancy_abort(char const*, int, char const*) ???:0 0x13df0f7 irange::set(tree_node*, generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_storage> const&, value_range_kind) ???:0 0x1e24a5d handle_printf_call(gimple_stmt_iterator*, pointer_query&) ???:0 0x12d3d86 strlen_pass::check_and_optimize_call(bool*) ???:0 0x12d4109 strlen_pass::check_and_optimize_stmt(bool*) ???:0 0x12d4494 strlen_pass::before_dom_children(basic_block_def*) ???:0 0x1d98997 dom_walker::walk(basic_block_def*) ???:0 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. ``` This crash can be verified at https://gcc.godbolt.org/z/439GM47z9