public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] arm: fix array-out-of-bounds upon register parsing error
@ 2021-06-10  7:43 Jan Beulich
  2021-06-10 10:29 ` Richard Earnshaw
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2021-06-10  7:43 UTC (permalink / raw)
  To: Binutils; +Cc: Nick Clifton, richard.earnshaw, ramana.radhakrishnan

Despite the comment ahead of the enum explicitly pointing out the need
to also update the corresponding array, 1b8833198c0 ("Add support for
MVE instructions: vcmp and vpt") failed to do so. Oddly enough the issue
appears to be spotted only by rather old gcc (4.3-ish in my case).

gas/
2021-06-XX  Jan Beulich  <jbeulich@suse.com>

	* config/tc-arm.c (reg_expected_msgs): Add REG_TYPE_ZR entry.

--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -729,7 +729,8 @@ const char * const reg_expected_msgs[] =
   [REG_TYPE_MMXWCG] = N_("iWMMXt scalar register expected"),
   [REG_TYPE_XSCALE] = N_("XScale accumulator register expected"),
   [REG_TYPE_MQ]	    = N_("MVE vector register expected"),
-  [REG_TYPE_RNB]    = ""
+  [REG_TYPE_RNB]    = "",
+  [REG_TYPE_ZR]     = N_("ZR register expected"),
 };
 
 /* Some well known registers that we refer to directly elsewhere.  */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: fix array-out-of-bounds upon register parsing error
  2021-06-10  7:43 [PATCH] arm: fix array-out-of-bounds upon register parsing error Jan Beulich
@ 2021-06-10 10:29 ` Richard Earnshaw
  2021-06-10 10:45   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Earnshaw @ 2021-06-10 10:29 UTC (permalink / raw)
  To: Jan Beulich, Binutils; +Cc: richard.earnshaw, ramana.radhakrishnan

OK.

I wonder if we could somehow build in an assert to check this.  Even 
better would be a static assertion during compilation, but that might be 
harder.

On 10/06/2021 08:43, Jan Beulich via Binutils wrote:
> Despite the comment ahead of the enum explicitly pointing out the need
> to also update the corresponding array, 1b8833198c0 ("Add support for
> MVE instructions: vcmp and vpt") failed to do so. Oddly enough the issue
> appears to be spotted only by rather old gcc (4.3-ish in my case).
> 
> gas/
> 2021-06-XX  Jan Beulich  <jbeulich@suse.com>
> 
> 	* config/tc-arm.c (reg_expected_msgs): Add REG_TYPE_ZR entry.
> 
> --- a/gas/config/tc-arm.c
> +++ b/gas/config/tc-arm.c
> @@ -729,7 +729,8 @@ const char * const reg_expected_msgs[] =
>     [REG_TYPE_MMXWCG] = N_("iWMMXt scalar register expected"),
>     [REG_TYPE_XSCALE] = N_("XScale accumulator register expected"),
>     [REG_TYPE_MQ]	    = N_("MVE vector register expected"),
> -  [REG_TYPE_RNB]    = ""
> +  [REG_TYPE_RNB]    = "",
> +  [REG_TYPE_ZR]     = N_("ZR register expected"),
>   };
>   
>   /* Some well known registers that we refer to directly elsewhere.  */
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: fix array-out-of-bounds upon register parsing error
  2021-06-10 10:29 ` Richard Earnshaw
@ 2021-06-10 10:45   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2021-06-10 10:45 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: richard.earnshaw, ramana.radhakrishnan, Binutils

On 10.06.2021 12:29, Richard Earnshaw wrote:
> OK.

Thanks, committed.

> I wonder if we could somehow build in an assert to check this.  Even 
> better would be a static assertion during compilation, but that might be 
> harder.

A Linux-like (or wherever its origin) BUILD_BUG_ON() shouldn't be that
hard to put in, even if _Static_assert() can't be used (unconditionally)
just yet.

Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-10 10:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  7:43 [PATCH] arm: fix array-out-of-bounds upon register parsing error Jan Beulich
2021-06-10 10:29 ` Richard Earnshaw
2021-06-10 10:45   ` Jan Beulich

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