https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84919
--- Comment #17 from Martin Sebor <msebor at gcc dot gnu.org> --- The patch below avoids the warning. Unfortunately, as a result of bug 92666, it triggers another bogus warning during bootstrap. Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c (revision 278975) +++ gcc/c-family/c-common.c (working copy) @@ -5763,8 +5763,26 @@ check_function_arguments (location_t loc, const_tr if (warn_format) check_function_sentinel (fntype, nargs, argarray); - if (warn_restrict) - warned_p |= check_function_restrict (fndecl, fntype, nargs, argarray); + if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)) + { + switch (DECL_FUNCTION_CODE (fndecl)) + { + case BUILT_IN_SPRINTF: + case BUILT_IN_SPRINTF_CHK: + case BUILT_IN_SNPRINTF: + case BUILT_IN_SNPRINTF_CHK: + /* Let the sprintf pass handle these. */ + return warned_p; + + default: + break; + } + } + + /* check_function_restrict sets the DECL_READ_P for arguments + so it must be called unconiditionally. */ + warned_p |= check_function_restrict (fndecl, fntype, nargs, argarray); + return warned_p; }