https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89934
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code |ice-on-invalid-code Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Summary|[9 Regression] ICE in |[9 Regression] ICE on a |tree_fits_uhwi_p, at |call with fewer arguments |tree.c:7237 |to strncpy declared without | |prototype --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Declaring a built-in function with an incompatible signature is unsafe but GCC only diagnoses it with -Wextra (starting with GCC 9). Calling a library function with fewer arguments than it expects is undefined. Calling a built-in function with fewer arguments is invalid and diagnosed (also starting in GCC 9) but not rejected. The call should either be rejected with an error (like Clang does) or replaced with a trap to avoid the undefined behavior at runtime, but it's too late to make that change for GCC 9. Hopefully in GCC 10. In the meantime, let me remove the assumption that the call is valid from the -Wrestrict pass.