[PATCH] IA-64/GAS: Fix format truncation compilation errors
Maciej W. Rozycki
macro@orcam.me.uk
Wed Aug 6 22:01:28 GMT 2025
More information about the Binutils mailing list
Wed Aug 6 22:01:28 GMT 2025
- Previous message (by thread): gprofng-gui 2.1 released
- Next message (by thread): [PATCH] IA-64/GAS: Fix format truncation compilation errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fix compilation errors:
.../gas/config/tc-ia64.c: In function 'declare_register_set':
.../gas/config/tc-ia64.c:5375:41: error: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Werror=format-truncation=]
5375 | snprintf (name, sizeof (name), "%s%u", prefix, i);
| ^~
.../gas/config/tc-ia64.c:5375:38: note: directive argument in the range [0, 4294967294]
5375 | snprintf (name, sizeof (name), "%s%u", prefix, i);
| ^~~~~~
.../gas/config/tc-ia64.c:5375:7: note: 'snprintf' output 2 or more bytes (assuming 11) into a destination of size 8
5375 | snprintf (name, sizeof (name), "%s%u", prefix, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
observed with GCC 10. Pick 16 for a round 64-bit stack frame size.
---
gas/config/tc-ia64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
binutils-gas-ia64-format-truncation.diff
Index: binutils-gdb/gas/config/tc-ia64.c
===================================================================
--- binutils-gdb.orig/gas/config/tc-ia64.c
+++ binutils-gdb/gas/config/tc-ia64.c
@@ -5367,7 +5367,7 @@ declare_register_set (const char *prefix
unsigned int num_regs,
unsigned int base_regnum)
{
- char name[8];
+ char name[16];
unsigned int i;
for (i = 0; i < num_regs; ++i)
- Previous message (by thread): gprofng-gui 2.1 released
- Next message (by thread): [PATCH] IA-64/GAS: Fix format truncation compilation errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list