This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]