This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, hsa]: Increase buffer size to avoid bootstrap failure on alpha
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Martin Liska <mliska at suse dot cz>, Martin Jambor <mjambor at suse dot cz>
- Date: Thu, 11 Jan 2018 20:21:50 +0100
- Subject: [PATCH, hsa]: Increase buffer size to avoid bootstrap failure on alpha
- Authentication-results: sourceware.org; auth=none
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);