diff mbox series

[hsa] : Increase buffer size to avoid bootstrap failure on alpha

Message ID CAFULd4YqQpxZ10aCCoB7mXS+cFYto=6RxfEpq0S=RHyg5Xu14w@mail.gmail.com
State New
Headers show
Series [hsa] : Increase buffer size to avoid bootstrap failure on alpha | expand

Commit Message

Uros Bizjak Jan. 11, 2018, 7:21 p.m. UTC
Hello!

Current gcc fails bootstrap on alpha-linux-gnu with:

/space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c: In function ‘void
dump_hsa_symbol(FILE*, hsa_symbol*)’:
/space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c:784:21: error: ‘%s’
directive writing up to 71 bytes into a region of size 62
[-Werror=format-overflow=]
       sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
                     ^~~~~~~~~
/space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c:784:15: note:
‘sprintf’ output between 5 and 86 bytes into a destination of size 64
       sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         symbol->m_name_number);
         ~~~~~~~~~~~~~~~~~~~~~~

suggesting that  a temporary sprintf buffer is too small.

Bootstrap is fixed by the following patch.

2018-01-11  Uros Bizjak  <ubizjak@gmail.com>

    * hsa-dump.c (dump_hsa_symbol): Increase buf size to 128.

OK for mainline?

Uros.

Comments

Richard Sandiford Jan. 11, 2018, 9:59 p.m. UTC | #1
Uros Bizjak <ubizjak@gmail.com> writes:
> Hello!
>
> Current gcc fails bootstrap on alpha-linux-gnu with:
>
> /space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c: In function ‘void
> dump_hsa_symbol(FILE*, hsa_symbol*)’:
> /space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c:784:21: error: ‘%s’
> directive writing up to 71 bytes into a region of size 62
> [-Werror=format-overflow=]
>        sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
>                      ^~~~~~~~~
> /space/homedirs/uros/gcc-svn/trunk/gcc/hsa-dump.c:784:15: note:
> ‘sprintf’ output between 5 and 86 bytes into a destination of size 64
>        sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
>        ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>          symbol->m_name_number);
>          ~~~~~~~~~~~~~~~~~~~~~~
>
> suggesting that  a temporary sprintf buffer is too small.

You've probably already seen, sorry, but this was a false positive,
fixed by:

2018-01-10  Martin Sebor  <msebor@redhat.com>

	PR tree-optimization/83781
	* gimple-fold.c (get_range_strlen): Avoid treating arrays of pointers
	as string arrays.

Thanks,
Richard
diff mbox series

Patch

Index: hsa-dump.c
===================================================================
--- hsa-dump.c  (revision 256437)
+++ hsa-dump.c  (working copy)
@@ -780,7 +780,7 @@  dump_hsa_symbol (FILE *f, hsa_symbol *symbol)
     name = symbol->m_name;
   else
     {
-      char buf[64];
+      char buf[128];
       sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
               symbol->m_name_number);