# HG changeset patch # User Christian Urban # Date 1386697695 0 # Node ID ef573e8fc86e631227753f6a01ba0b7ce30f2899 # Parent 70198792c2aa29f3d229152fc5b4b13b52984e89 bug found by Andres diff -r 70198792c2aa -r ef573e8fc86e progs/fun.scala --- a/progs/fun.scala Thu Dec 05 10:29:35 2013 +0000 +++ b/progs/fun.scala Tue Dec 10 17:48:15 2013 +0000 @@ -221,7 +221,7 @@ // calculating the maximal needed stack size def max_stack_exp(e: Exp): Int = e match { case Call(_, args) => args.map(max_stack_exp).sum - case If(a, e1, e2) => max_stack_bexp(a) + (List(max_stack_exp(e1), max_stack_exp(e1)).max) + case If(a, e1, e2) => max_stack_bexp(a) + (List(max_stack_exp(e1), max_stack_exp(e2)).max) case Write(e) => max_stack_exp(e) + 1 case Var(_) => 1 case Num(_) => 1 @@ -479,5 +479,5 @@ //examples -compile_run("defs.rec") -//compile_run("fact.rec") +//compile_run("defs.rec") +compile_run("fact.rec")