https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83655
Bug ID: 83655 Summary: [8 Regression] ICE on an invalid call to memcpy declared with no prototype Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- When mecmpy() or strncpy() (and possibly other built-in functions) is declared without a prototype and called with arguments of the wrong types GCC crashes in the -Wrestrict pass. This is a similar but not exactly the same problem as bug 83603 which points out a crash due to a call with an insufficient number of arguments. $ cat d.c && gcc -O2 -S -Wall d.c void* memcpy (); void f (void) { memcpy (1, 2, ""); } during GIMPLE pass: wrestrict d.c: In function âfâ: d.c:3:6: internal compiler error: Segmentation fault void f (void) ^ 0xfcd34d crash_signal /ssd/src/gcc/git/gcc/toplev.c:325 0x7ada8a contains_struct_check(tree_node const*, tree_node_structure_enum, char const*, int, char const*) /ssd/src/gcc/git/gcc/tree.h:3497 0x926f06 wi::extended_tree<128>::extended_tree(tree_node const*) /ssd/src/gcc/git/gcc/tree.h:5443 0x925d0d generic_wide_int<wi::extended_tree<128> >::generic_wide_int<tree_node const*>(tree_node const* const&) /ssd/src/gcc/git/gcc/wide-int.h:749 0x9258f2 wi::to_offset(tree_node const*) /ssd/src/gcc/git/gcc/tree.h:5395 0xbfdfe3 builtin_memref /ssd/src/gcc/git/gcc/gimple-ssa-warn-restrict.c:393 0xc04286 check_bounds_or_overlap(gcall*, tree_node*, tree_node*, tree_node*, tree_node*, bool) /ssd/src/gcc/git/gcc/gimple-ssa-warn-restrict.c:1720 0xc041a0 check_call /ssd/src/gcc/git/gcc/gimple-ssa-warn-restrict.c:1691 0xbfd0a6 before_dom_children /ssd/src/gcc/git/gcc/gimple-ssa-warn-restrict.c:106 0x1b6127f dom_walker::walk(basic_block_def*) /ssd/src/gcc/git/gcc/domwalk.c:308 0xbfd12a execute /ssd/src/gcc/git/gcc/gimple-ssa-warn-restrict.c:120 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.