]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
TIC6X/GAS: Work around array bounds compilation error
authorMaciej W. Rozycki <macro@orcam.me.uk>
Mon, 6 Oct 2025 20:37:27 +0000 (21:37 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Mon, 6 Oct 2025 20:37:27 +0000 (21:37 +0100)
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.

gas/config/tc-tic6x.c

index 7862236300686d9effcbe0d33535d562640cdcbe..1ef07764c2f2ee17c18594a9af33a81888c0c164 100644 (file)
@@ -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.");