* [patch] More -Wstack-usage warnings: opcodes/aarch64-*
@ 2016-03-24 20:39 Jan Kratochvil
2016-03-24 21:35 ` Marcus Shawcroft
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2016-03-24 20:39 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
Hi,
gcc-6.0.0-0.16.fc25.x86_64
aarch64-dis.c: In function ‘print_operands’:
aarch64-dis.c:2151:1: error: stack usage might be unbounded [-Werror=stack-usage=]
aarch64-opc.c: In function ‘print_register_offset_address’:
aarch64-opc.c:2301:1: error: stack usage might be unbounded [-Werror=stack-usage=]
OK for check-in?
I have looked at
https://sourceware.org/bugzilla/show_bug.cgi?id=19851
and made the fix similar.
Jan
[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 2134 bytes --]
opcodes/
2016-03-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix -Wstack-usage warnings.
* aarch64-dis.c (print_operands): Substitute size.
* aarch64-opc.c (print_register_offset_address): Substitute tblen.
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 025d5d1..05e4768 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -2154,8 +2154,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
int i, pcrel_p, num_printed;
for (i = 0, num_printed = 0; i < AARCH64_MAX_OPND_NUM; ++i)
{
- const size_t size = 128;
- char str[size];
+ char str[128];
/* We regard the opcode operand info more, however we also look into
the inst->operands to support the disassembling of the optional
operand.
@@ -2166,7 +2165,7 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode,
break;
/* Generate the operand string in STR. */
- aarch64_print_operand (str, size, pc, opcode, opnds, i, &pcrel_p,
+ aarch64_print_operand (str, sizeof (str), pc, opcode, opnds, i, &pcrel_p,
&info->target);
/* Print the delimiter (taking account of omitted operand(s)). */
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index ae06ee3..76992df 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -2301,8 +2301,7 @@ static void
print_register_offset_address (char *buf, size_t size,
const aarch64_opnd_info *opnd)
{
- const size_t tblen = 16;
- char tb[tblen]; /* Temporary buffer. */
+ char tb[16]; /* Temporary buffer. */
bfd_boolean lsl_p = FALSE; /* Is LSL shift operator? */
bfd_boolean wm_p = FALSE; /* Should Rm be Wm? */
bfd_boolean print_extend_p = TRUE;
@@ -2334,9 +2333,9 @@ print_register_offset_address (char *buf, size_t size,
if (print_extend_p)
{
if (print_amount_p)
- snprintf (tb, tblen, ",%s #%d", shift_name, opnd->shifter.amount);
+ snprintf (tb, sizeof (tb), ",%s #%d", shift_name, opnd->shifter.amount);
else
- snprintf (tb, tblen, ",%s", shift_name);
+ snprintf (tb, sizeof (tb), ",%s", shift_name);
}
else
tb[0] = '\0';
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] More -Wstack-usage warnings: opcodes/aarch64-*
2016-03-24 20:39 [patch] More -Wstack-usage warnings: opcodes/aarch64-* Jan Kratochvil
@ 2016-03-24 21:35 ` Marcus Shawcroft
2016-03-24 21:43 ` [commit] " Jan Kratochvil
0 siblings, 1 reply; 3+ messages in thread
From: Marcus Shawcroft @ 2016-03-24 21:35 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: binutils
On 24 March 2016 at 20:39, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> Hi,
>
> gcc-6.0.0-0.16.fc25.x86_64
>
> aarch64-dis.c: In function ‘print_operands’:
> aarch64-dis.c:2151:1: error: stack usage might be unbounded [-Werror=stack-usage=]
> aarch64-opc.c: In function ‘print_register_offset_address’:
> aarch64-opc.c:2301:1: error: stack usage might be unbounded [-Werror=stack-usage=]
>
> OK for check-in?
OK. Thanks /Marcus
^ permalink raw reply [flat|nested] 3+ messages in thread
* [commit] [patch] More -Wstack-usage warnings: opcodes/aarch64-*
2016-03-24 21:35 ` Marcus Shawcroft
@ 2016-03-24 21:43 ` Jan Kratochvil
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2016-03-24 21:43 UTC (permalink / raw)
To: Marcus Shawcroft; +Cc: binutils
On Thu, 24 Mar 2016 22:35:00 +0100, Marcus Shawcroft wrote:
> OK. Thanks /Marcus
Checked in:
0d2f91fe2d5ea93dc3dc76780e6ec2e27d022d39
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-24 21:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-24 20:39 [patch] More -Wstack-usage warnings: opcodes/aarch64-* Jan Kratochvil
2016-03-24 21:35 ` Marcus Shawcroft
2016-03-24 21:43 ` [commit] " Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).