From d2c3a8d85672f5d04136a634a21a3120f8ef9581 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Thu, 14 May 2026 19:37:39 -0400 Subject: [PATCH 1/2] fix: update fypp linemarker-resync patch header for fypp 3.2 The original patch was written against an older fypp version where the target hunk began at line 1842 with 11 old / 16 new lines. In fypp 3.2 the same code sits at line 1848 and the hunk is smaller (7 old / 13 new), causing 'patch' to reject the file as malformed and emit a startup warning on every mfc.sh invocation. Regenerated the patch directly from the installed fypp 3.2 source. The actual change (adding 'or True' to always emit resync linemarkers after single-line $: calls) is identical. --- toolchain/patches/fypp-linemarker-resync.patch | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/toolchain/patches/fypp-linemarker-resync.patch b/toolchain/patches/fypp-linemarker-resync.patch index 6f6dfadf7f..fc2a3190c1 100644 --- a/toolchain/patches/fypp-linemarker-resync.patch +++ b/toolchain/patches/fypp-linemarker-resync.patch @@ -1,12 +1,6 @@ ---- a/fypp.py -+++ b/fypp.py -@@ -1842,11 +1842,16 @@ class _Renderer: - if self._linenums: - # Last line was folded, but no linenums were generated for - # the continuation lines -> current line position is not - # in sync with the one calculated from the last line number - unsync = ( - len(foldedlines) and len(foldedlines[-1]) > 1 +--- a/fypp.py 2026-05-14 18:22:07.622131094 -0400 ++++ b/fypp.py 2026-05-14 18:22:07.650131330 -0400 +@@ -1848,7 +1848,13 @@ and not self._contlinenums) # Eval directive in source consists of more than one line multiline = span[1] - span[0] > 1 @@ -21,5 +15,3 @@ # For inline eval directives span[0] == span[1] # -> next line is span[0] + 1 and not span[1] as for # line eval directives - nextline = max(span[1], span[0] + 1) - trailing += self._linenumdir(nextline, fname) From aee8996e87693cd25ef755ac3e5add01989a37b8 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Thu, 14 May 2026 19:44:53 -0400 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20remove=20dead=20'or=20True'=20guard?= =?UTF-8?q?=20=E2=80=94=20unconditionally=20emit=20resync=20marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addressed code review feedback: 'if unsync or multiline or True' makes the unsync/multiline sub-expressions dead code. Since the intent is to always emit a resync linemarker after a $: call, remove the if guard entirely and dedent the body, making the unconditional behaviour explicit in the code rather than hiding it behind a tautological condition. --- .../patches/fypp-linemarker-resync.patch | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/toolchain/patches/fypp-linemarker-resync.patch b/toolchain/patches/fypp-linemarker-resync.patch index fc2a3190c1..d8c0c829a5 100644 --- a/toolchain/patches/fypp-linemarker-resync.patch +++ b/toolchain/patches/fypp-linemarker-resync.patch @@ -1,17 +1,26 @@ ---- a/fypp.py 2026-05-14 18:22:07.622131094 -0400 -+++ b/fypp.py 2026-05-14 18:22:07.650131330 -0400 -@@ -1848,7 +1848,13 @@ +--- a/fypp.py 2026-05-14 19:44:34.158817311 -0400 ++++ b/fypp.py 2026-05-14 19:44:34.188817564 -0400 +@@ -1848,12 +1848,17 @@ and not self._contlinenums) # Eval directive in source consists of more than one line multiline = span[1] - span[0] > 1 - if unsync or multiline: +- # For inline eval directives span[0] == span[1] +- # -> next line is span[0] + 1 and not span[1] as for +- # line eval directives +- nextline = max(span[1], span[0] + 1) +- trailing += self._linenumdir(nextline, fname) + # Always emit a resync marker after a $: call. Without this, + # single-line $: calls that expand to multi-line #if/#endif + # blocks (e.g. GPU_PARALLEL_LOOP) cause the compiler to + # attribute the next Fortran statement to the call-site line + # rather than the following source line, producing off-by-1 + # errors in backtraces and debugger line info. -+ if unsync or multiline or True: - # For inline eval directives span[0] == span[1] - # -> next line is span[0] + 1 and not span[1] as for - # line eval directives ++ # For inline eval directives span[0] == span[1] ++ # -> next line is span[0] + 1 and not span[1] as for ++ # line eval directives ++ nextline = max(span[1], span[0] + 1) ++ trailing += self._linenumdir(nextline, fname) + else: + trailing = '' + return result + trailing