From 436d50b54cf30f604a1bfbf808b484552e0523f4 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 20 Sep 2018 00:49:31 +0200 Subject: [PATCH] Create correctly sized csa descriptors in the Basic compiler. --- lang/basic/src/graph.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/basic/src/graph.c b/lang/basic/src/graph.c index 732fc301d..a960659b7 100644 --- a/lang/basic/src/graph.c +++ b/lang/basic/src/graph.c @@ -199,19 +199,26 @@ int lab; genreturns() { + int count; int nr; nr= genlabel(); C_df_dnam("returns"); C_rom_ilb((label) nr); C_rom_cst((arith)1); - C_rom_cst((arith) (gosubcnt-1)); + C_rom_cst((arith) (gosubcnt-2)); + count = 0; while ( gosubhead) { C_rom_ilb((label) gosubhead->emlabel); gosubhead= gosubhead->nextlist; + count++; } + + if (count != (gosubcnt-1)) + error("gosub count table mismatch"); + C_df_ilb((label) nr); C_loc((arith) 1); C_cal("error");