shithub: rgbds

Download patch

ref: dca24a6d500565997156f25544572cd1d4c4dbe3
parent: 4363ffcad480775e9cb9b546ac4b53975ed3a77c
author: Rangi <[email protected]>
date: Sun Aug 28 11:34:01 EDT 2022

Test that `OPT r` fails immediately if the recursion depth is already exceeded

Fixes #1034

--- /dev/null
+++ b/test/asm/opt-r-decrease.asm
@@ -1,0 +1,11 @@
+MACRO m
+  DEF depth += 1
+  IF depth == 10
+    OPT r9
+  ENDC
+  println "at depth {d:depth}"
+  m
+ENDM
+
+  DEF depth = 0
+  m
--- /dev/null
+++ b/test/asm/opt-r-decrease.err
@@ -1,0 +1,2 @@
+FATAL: opt-r-decrease.asm(11) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(4):
+    Recursion limit (9) exceeded
--- /dev/null
+++ b/test/asm/opt-r-decrease.out
@@ -1,0 +1,9 @@
+at depth 1
+at depth 2
+at depth 3
+at depth 4
+at depth 5
+at depth 6
+at depth 7
+at depth 8
+at depth 9