Bulletin number: 372 Products affected: D4205 D5205 D7205 Description: Occam Compiler - FPU stack overflow Component: oc Date: Mon Sep 30 14:22:26 BST 1991 ----- Code such as the following causes the FPU stack to overflow on Transputers with a floating point unit T800 T801 T805. VAL REAL32 KA IS 1.0(REAL32) : VAL REAL32 KB IS 1.0(REAL32) : REAL32 x,y,wo1,wo2 : SEQ x := 1.0(REAL32) y := 1.0(REAL32) ans1 :=( ( ((KA*x)*y) - (x*KB) ) + (x*x) ) + (y*y) ans2 := ( ((KA*x)*y) - (x*KC) ) +( (x*x) + (y*y) ) It is clear that ans1 and ans2 should give the same result of 2.0. But if this program is compiled with T8 option and execute on T8, the result is ans1=2.0 and ans2=3.0 It ONLY happens with complicated expressions containing CONSTANTS. The constants can be VALs or explicit in the expression. ans1 in the example works because the parentheses happen to be nested such that the stack does not overflow. But if the sub-expressions were more complex the bug could exhibit itself there as well. The workaround is to break this kind of complex expression up into smaller intermediate results and store them in temporary variables. This will be fixed in the next revision of the compiler.