https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97190
Bug ID: 97190 Summary: [11 Regression] ICE in get_location_from_adhoc_loc at libcpp/line-map.c:257 since r11-2928-gd14c547abd484d35 Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: msebor at gcc dot gnu.org Target Milestone: --- The following ICEs: $ cat strncat.c #include <string.h> #include <stdlib.h> test1(char *to, int to_size, char from) { strncat(to, from, 2); } main() { size_t to_size = 0; char *to = malloc(to_size); char from; test1(to, to_size, from); } $ gcc strncat.c -c -O1 strncat.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | test1(char *to, int to_size, char from) { strncat(to, from, 2); } | ^~~~~ strncat.c: In function ‘test1’: strncat.c:4:55: warning: passing argument 2 of ‘strncat’ makes pointer from integer without a cast [-Wint-conversion] 4 | test1(char *to, int to_size, char from) { strncat(to, from, 2); } | ^~~~ | | | char In file included from strncat.c:1: /usr/include/string.h:133:71: note: expected ‘const char * restrict’ but argument is of type ‘char’ 133 | extern char *strncat (char *__restrict __dest, const char *__restrict __src, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ strncat.c: At top level: strncat.c:5:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 5 | main() { | ^~~~ In function ‘test1’, inlined from ‘main’ at strncat.c:9:3: strncat.c:4:43: warning: ‘strncat’ specified bound 2 exceeds destination size 0 [-Wstringop-overflow=] 4 | test1(char *to, int to_size, char from) { strncat(to, from, 2); } | ^~~~~~~~~~~~~~~~~~~~ during RTL pass: expand strncat.c: In function ‘main’: strncat.c:4:43: internal compiler error: Segmentation fault 0xb1b95f crash_signal /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/toplev.c:329 0x7ffff76a652f ??? /usr/src/debug/glibc-2.31-6.3.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x14c3a67 get_location_from_adhoc_loc(line_maps const*, unsigned int) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/libcpp/line-map.c:257 0x14c3a67 linemap_resolve_location(line_maps*, unsigned int, location_resolution_kind, line_map_ordinary const**) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/libcpp/line-map.c:1540 0x149afa9 diagnostic_report_current_module(diagnostic_context*, unsigned int) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/diagnostic.c:683 0xb64481 diagnostic_report_current_function(diagnostic_context*, diagnostic_info*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/tree-diagnostic.c:39 0xb644c0 default_tree_diagnostic_starter /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/tree-diagnostic.c:48 0x149a1f6 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/diagnostic.c:1206 0x149c6c7 diagnostic_impl /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/diagnostic.c:1355 0x149c6c7 inform(unsigned int, char const*, ...) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/diagnostic.c:1434 0x7226db maybe_warn_for_bound /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/builtins.c:3483 0x725f28 maybe_warn_for_bound /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/builtins.c:3361 0x725f28 check_access(tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, access_mode, access_data const*) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/builtins.c:4071 0x7295cf expand_builtin_strncat /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/builtins.c:5284 0x72c136 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/builtins.c:8665 0x849652 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/expr.c:11243 0x74b73e expand_expr /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/expr.h:282 0x74b73e expand_call_stmt /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/cfgexpand.c:2703 0x74b73e expand_gimple_stmt_1 /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/cfgexpand.c:3686 0x74b73e expand_gimple_stmt /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-trunk-x86_64/build/gcc/cfgexpand.c:3851 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.