From: Alan Modra Date: Mon, 16 Feb 2026 23:29:13 +0000 (+1030) Subject: gas: macros nested too deep error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc2fcd4f5be3;p=thirdparty%2Fbinutils-gdb.git gas: macros nested too deep error .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: Info: macro invoked from here nest.s:1: 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); }