Create correctly sized csa descriptors in the Basic compiler.

This commit is contained in:
David Given 2018-09-20 00:49:31 +02:00
parent cb20856aea
commit 436d50b54c

View file

@ -199,19 +199,26 @@ int lab;
genreturns() genreturns()
{ {
int count;
int nr; int nr;
nr= genlabel(); nr= genlabel();
C_df_dnam("returns"); C_df_dnam("returns");
C_rom_ilb((label) nr); C_rom_ilb((label) nr);
C_rom_cst((arith)1); C_rom_cst((arith)1);
C_rom_cst((arith) (gosubcnt-1)); C_rom_cst((arith) (gosubcnt-2));
count = 0;
while ( gosubhead) while ( gosubhead)
{ {
C_rom_ilb((label) gosubhead->emlabel); C_rom_ilb((label) gosubhead->emlabel);
gosubhead= gosubhead->nextlist; gosubhead= gosubhead->nextlist;
count++;
} }
if (count != (gosubcnt-1))
error("gosub count table mismatch");
C_df_ilb((label) nr); C_df_ilb((label) nr);
C_loc((arith) 1); C_loc((arith) 1);
C_cal("error"); C_cal("error");