From 958c1c09e70f1bf6e8313e78ca3d0277b44bfe1d Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Wed, 3 Feb 2021 09:58:39 +0100 Subject: [PATCH] #98: Warning about a missing call to init_rw_memory --- src/main/scala/millfork/output/AbstractAssembler.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/millfork/output/AbstractAssembler.scala b/src/main/scala/millfork/output/AbstractAssembler.scala index 07342827..5527dc6a 100644 --- a/src/main/scala/millfork/output/AbstractAssembler.scala +++ b/src/main/scala/millfork/output/AbstractAssembler.scala @@ -594,6 +594,9 @@ abstract class AbstractAssembler[T <: AbstractCode](private val program: Program val db = mem.banks("default") val ib = mem.banks(ivBank) val size = rwDataEnd - rwDataStart + if (size > 0 && !labelMap.contains("init_rw_memory")) { + log.warn("The program contains initialized variables, but it never calls init_rw_memory().") + } if (size < 0) log.fatal("Negative writable memory size. It's a compiler bug.") val ivAddr = codeAllocators(ivBank).allocateBytes(ib, options, size, initialized = true, writeable = false, AllocationLocation.High, NoAlignment) unimportantLabelMap += "__rwdata_init_start" -> (ib.index -> ivAddr)