Hi 

This warning will become ERROR in stage2 of bootstrap when use 
" make BOOT_CFLAGS='-O0' BOOT_CXXFLAGS='-O0' " command.
So it is better to fix this warning. 
There are other similar warnings. I will submit patches one by one.

Tested on x86_64. OK for trunk?

> -----Original Message-----
> From: Qian Jianhua <qia...@cn.fujitsu.com>
> Sent: Friday, March 18, 2022 6:02 PM
> To: Qian, Jianhua/钱 建华 <qia...@fujitsu.com>
> Subject: [PATCH] Avoid a warning of overflow
> 
> This patch avoid a warning of "c-ada-spec.cc:1660:34: warning:
> 'sprintf' may write a terminating nul past the end of the destination
> [-Wformat-overflow=]" when build GCC.
> 
> gcc/c-family/
>       * c-ada-spec.cc: Change array length
> 
> ---
>  gcc/c-family/c-ada-spec.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index
> 149d336ee96..aeb429136b6 100644
> --- a/gcc/c-family/c-ada-spec.cc
> +++ b/gcc/c-family/c-ada-spec.cc
> @@ -1579,7 +1579,7 @@ dump_ada_function_declaration (pretty_printer
> *buffer, tree func,
>    tree type = TREE_TYPE (func);
>    tree arg = TYPE_ARG_TYPES (type);
>    tree t;
> -  char buf[17];
> +  char buf[18];
>    int num, num_args = 0, have_args = true, have_ellipsis = false;
> 
>    /* Compute number of arguments.  */
> --
> 2.18.1

Reply via email to