https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117254
Bug ID: 117254 Summary: ICE: have var_decl in get_len, at tree.h:6512 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- ******************************************************************************* OS and Platform: $ uname -a: Linux 65dac7c84719 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* gcc version: Using built-in specs. COLLECT_GCC=/home/software/gcc-trunk-3aa004f/bin/gcc COLLECT_LTO_WRAPPER=/home/software/gcc-trunk-3aa004f/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --disable-multilib --disable-bootstrap --enable-languages=c,c++ --prefix=/home/software/gcc-trunk-3aa004f --enable-coverage Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240630 (experimental) (GCC) ******************************************************************************* Program: $ cat mutant.c int g; char *strncpy(); #define a(b, c, d) strncpy(b, c) void e() { struct { __attribute__((nonstring)) char bn[g]; } f; a(f, f.bn, ); } ******************************************************************************* Command Lines: $ gcc mutant.c mutant.c: In function 'e': mutant.c:8:5: warning: incompatible type for argument 1 of 'strncpy' [-Wbuiltin-declaration-mismatch] 8 | a(f, f.bn, ); | ^ mutant.c:3:28: note: in definition of macro 'a' 3 | #define a(b, c, d) strncpy(b, c) | ^ mutant.c:2:7: note: expected 'char *' but argument is of type 'struct <anonymous>' 2 | char *strncpy(); | ^~~~~~~ mutant.c:3:20: warning: too few arguments to built-in function 'strncpy' expecting 3 [-Wbuiltin-declaration-mismatch] 3 | #define a(b, c, d) strncpy(b, c) | ^~~~~~~ mutant.c:8:3: note: in expansion of macro 'a' 8 | a(f, f.bn, ); | ^ mutant.c:2:7: note: declared here 2 | char *strncpy(); | ^~~~~~~ during GIMPLE pass: waccess mutant.c:4:6: internal compiler error: tree check: expected integer_cst, have var_decl in get_len, at tree.h:6503 4 | void e() { | ^ 0x5071bcf diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x50724a1 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x50924c7 internal_error(char const*, ...) ???:0 0x2685230 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ???:0 0xd4aa08 tree_check(tree_node const*, char const*, int, char const*, tree_code) ???:0 0x103d6d7 wi::extended_tree<128>::get_len() const ???:0 0x103d4eb wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<128> > const&) ???:0 0x103d0c4 wide_int_ref_storage<true, false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, unsigned int) ???:0 0x103c402 generic_wide_int<wide_int_ref_storage<true, false> >::generic_wide_int<generic_wide_int<wi::extended_tree<128> > >(generic_wide_int<wi::extended_tree<128> > const&, unsigned int) ???:0 0x169187b wi::binary_traits<generic_wide_int<wi::extended_tree<128> >, int, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type, wi::int_traits<int>::precision_type>::result_type wi::add<generic_wide_int<wi::extended_tree<128> >, int>(generic_wide_int<wi::extended_tree<128> > const&, int const&) ???:0 0x168f2b2 wi::binary_traits<generic_wide_int<wi::extended_tree<128> >, int, wi::int_traits<generic_wide_int<wi::extended_tree<128> > >::precision_type, wi::int_traits<int>::precision_type>::operator_result operator+<generic_wide_int<wi::extended_tree<128> >, int>(generic_wide_int<wi::extended_tree<128> > const&, int const&) ???: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. Also ICE on trunk. Compiler Explorer: https://godbolt.org/z/bn19rjc4o