good13,cc : Inconsistent stack height 1 != 0

66 views
Skip to first unread message

Erik Jungmark

unread,
Feb 26, 2014, 8:09:30 AM2/26/14
to proglang-c...@googlegroups.com
When running good13.cc, we currently get the error message:

Inconsistent stack height 1 != 0

From testing, it seems like the problem lies in how we handle our while-loops. So, our questions are twofold:

1) What does the error message actually mean? It's obvious that it refers to the size of the stack, but does it mean that the stack is too large or too small?

2) Is the way that we handle loops correct?

SWhile exp stm        -> do loop <- newLabel
                              false <- newLabel
                              emit $ loop ++ ":"
                              compileExp exp
                              emit $ "ifeq " ++ false
                              compileStm stm
                              emit $ "goto " ++ loop
                              emit $ false ++ ":"

Mattias Warnqvist

unread,
Feb 26, 2014, 8:19:53 AM2/26/14
to proglang-c...@googlegroups.com
You need to have the same stack height each time you reach a specific label, so look at your statements and what you leave on the stack after each iteration.
Reply all
Reply to author
Forward
0 new messages