]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: macros nested too deep error
authorAlan Modra <amodra@gmail.com>
Mon, 16 Feb 2026 23:29:13 +0000 (09:59 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 17 Feb 2026 00:45:47 +0000 (11:15 +1030)
.macro r;r;.endm;r

Currently reports:
nest.s: Assembler messages:
nest.s:2: Fatal error: macros nested too deeply
nest.s:2:  Info: macro invoked from here
nest.s:2:   Info: macro invoked from here
...
nest.s:2:<much indenting> Info: macro invoked from here
nest.s:1:<much indenting>  Info: macro invoked from here

This patch corrects the line number reported, and downgrades the error
from as_fatal to as_bad.

* input-scrub.c (input_scrub_include_sb): Report "macros
nested too deeply" using as_bad.
* macro.c (buffer_and_nest): Only bump line number in .lineinfo
if we have a '\n'.

gas/input-scrub.c
gas/macro.c

index 2ccc2ce9c8ea8ef06913e7fe6a9ee94baf3b0a73..afb80ef2ce0c61e81bdef112fa194d6a8dc972fd 100644 (file)
@@ -298,7 +298,10 @@ input_scrub_include_sb (sb *from, char *position, enum expansion expansion)
   if (expansion != expanding_app)
     {
       if (macro_nest > max_macro_nest)
-       as_fatal (_("macros nested too deeply"));
+       {
+         as_bad (_("macros nested too deeply"));
+         return;
+       }
       ++macro_nest;
     }
 
index 6f204d94ce472378f80de3343ce4c7698b83de03..76989259feb61d333cbaa46afe87ff491a203a51 100644 (file)
@@ -104,10 +104,12 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
     const char *prefix = flag_m68k_mri ? "" : ".";
     const char *file = as_where_top (&line);
 
+    if (*input_line_pointer == '\n')
+      line++;
     if (file)
-      linefile = xasprintf ("\t%slinefile %u \"%s\"", prefix, line + 1, file);
+      linefile = xasprintf ("\t%slinefile %u \"%s\"", prefix, line, file);
     else
-      linefile = xasprintf ("\t%slinefile %u .", prefix, line + 1);
+      linefile = xasprintf ("\t%slinefile %u .", prefix, line);
     sb_add_string (ptr, linefile);
     xfree (linefile);
   }