shithub: rgbds

Download patch

ref: 7c8ec5a5edbdae184ce5c0f6bbcde6037340f209
parent: effc6788ebe0958f64b3218fbd341b4091ed016b
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Thu Oct 8 14:10:27 EDT 2020

Add a test case for charmaps that segfaults prior to this fix

--- /dev/null
+++ b/test/asm/charmap-inheritance.asm
@@ -1,0 +1,23 @@
+SECTION "test", ROM0
+
+	newcharmap foo
+
+	charmap "<START>",  $00
+	charmap "<RAM>",    $01
+	charmap "<WAIT>",   $02
+	charmap "<ASM>",    $03
+	charmap "<NUM>",    $04
+	charmap "<EXIT>",   $05
+	charmap "<SOUND>",  $06
+	charmap "<DAY>",    $07
+	charmap "<FAR>",    $08
+
+	; At this point, enough nodes were allocated for 'foo' to be reallocated.
+	; Its value in the charmaps' hashmap should have been updated too,
+	; so that usages of 'foo' will not segfault.
+
+	; This uses 'foo; by switching to it.
+	setcharmap foo
+
+	; This uses 'foo' by deriving another charmap from it.
+	newcharmap bar, foo