[binutils-gdb] TIC6X/GAS: Work around array bounds compilation error

Maciej W. Rozycki macro@sourceware.org
Mon Oct 6 20:39:46 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6d80adb93c8f24754fc4cd0fec91d46730d375be

commit 6d80adb93c8f24754fc4cd0fec91d46730d375be
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Mon Oct 6 21:37:27 2025 +0100

    TIC6X/GAS: Work around array bounds compilation error
    
    Work around a compilation error:
    
    .../gas/config/tc-tic6x.c: In function 'tic6x_start_unwind_section':
    .../gas/config/tc-tic6x.c:4632:17: error: offset '16' outside bounds of constant string [-Werror=array-bounds]
     4632 |       text_name += strlen (".gnu.linkonce.t.");
          |       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    observed with GCC 10.

Diff:
---
 gas/config/tc-tic6x.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index 78622363006..1ef07764c2f 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -4625,8 +4625,7 @@ tic6x_start_unwind_section (const segT text_seg, int idx)
   text_name = segment_name (text_seg);
   if (streq (text_name, ".text"))
     text_name = "";
-
-  if (startswith (text_name, ".gnu.linkonce.t."))
+  else if (startswith (text_name, ".gnu.linkonce.t."))
     {
       prefix = prefix_once;
       text_name += strlen (".gnu.linkonce.t.");


More information about the Binutils-cvs mailing list