https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100843
Bug ID: 100843 Summary: ICE with -O1: in try_store_by_multiple_pieces, at builtins.c:6739 Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: cnsun at uwaterloo dot ca Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/configure --enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch --prefix=/scratch/software/gcc-trunk --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210601 (experimental) [master revision :54832e2f6:28daadc98094501175c9dfe4a985871fa6aa4f94] (GCC) $ cat mutant.c char c; void *memset(); test_integer_conversion_memset(void *d) { memset(d, '\0', c); } $ gcc-trunk -O1 mutant.c mutant.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 3 | test_integer_conversion_memset(void *d) { memset(d, '\0', c); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mutant.c: In function ‘test_integer_conversion_memset’: mutant.c:3:59: warning: ‘memset’ argument 3 promotes to ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] 3 | test_integer_conversion_memset(void *d) { memset(d, '\0', c); } | ^ mutant.c:2:7: note: built-in ‘memset’ declared here 2 | void *memset(); | ^~~~~~ during RTL pass: expand mutant.c:3:43: internal compiler error: in try_store_by_multiple_pieces, at builtins.c:6739 3 | test_integer_conversion_memset(void *d) { memset(d, '\0', c); } | ^~~~~~~~~~~~~~~~~~ 0x681394 try_store_by_multiple_pieces(rtx_def*, rtx_def*, unsigned int, unsigned long, unsigned long, rtx_def*, char, unsigned int) /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/builtins.c:6739 0xb720bd clear_storage_hints(rtx_def*, rtx_def*, block_op_methods, unsigned int, long, unsigned long, unsigned long, unsigned long, unsigned int) /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/expr.c:3201 0xa099a2 expand_builtin_memset_args /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/builtins.c:6969 0xa1bbfe expand_builtin_memset /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/builtins.c:6685 0xa1bbfe expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/builtins.c:10187 0xb6be8c expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/expr.c:11429 0xa45f49 expand_expr /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/expr.h:301 0xa45f49 expand_call_stmt /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/cfgexpand.c:2846 0xa45f49 expand_gimple_stmt_1 /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/cfgexpand.c:3850 0xa45f49 expand_gimple_stmt /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/cfgexpand.c:4014 0xa4b8a9 expand_gimple_basic_block /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/cfgexpand.c:6056 0xa4d77f execute /tmp/tmp.4wFFqTQrHF-gcc-builder/gcc/gcc/cfgexpand.c:6782 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.