gas: macros nested too deep error
Alan Modra
amodra@gmail.com
Mon Feb 16 23:32:39 GMT 2026
More information about the Binutils mailing list
Mon Feb 16 23:32:39 GMT 2026
- Previous message (by thread): gas: further limit .rept count
- Next message (by thread): gas: abort in new_logical_line_flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
.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'.
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index 2ccc2ce9c8e..afb80ef2ce0 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -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;
}
diff --git a/gas/macro.c b/gas/macro.c
index 6f204d94ce4..76989259feb 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -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);
}
--
Alan Modra
- Previous message (by thread): gas: further limit .rept count
- Next message (by thread): gas: abort in new_logical_line_flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list