Function blocks as global vars

This test case it part of the test suite proposed for new devices.

Test case ID: R0096
Language: ST

Code:
tests2/t0096.st

// returns sum of outputs plus internal accumulator
// accumulator starts at 100 and increments in output
FUNCTION_BLOCK FBR0096
       VAR_INPUT
             x : INT;
             y : INT;
       END_VAR
       VAR 
            t : INT:=100;
       END_VAR
       VAR_OUTPUT
             z : INT;
       END_VAR
       z := x + y + t;  
       t := t + z;
END_FUNCTION_BLOCK 

PROGRAM R0096_INIT
       VAR_GLOBAL
             fb1g : FBR0096;
       END_VAR

       fb1g.x :=2; // no effect
       
END_PROGRAM
 
PROGRAM R0096_MAIN
       VAR_EXTERNAL
             fb1g : FBR0096;
       END_VAR
       VAR 
         fb2 : FBR0096;
             i1,i2 :INT;
       END_VAR
        
        
    fb2(x:=21,y:=6);  // z:127 t:100+127=227
    fb2.x := 31;
    fb2.y := 22;     
    fb2();          //  z:227+53=280  t: 227+280 =507
    i2 := fb2.z; 
   
    fb1g(x:=20,y:=5,z=>i1);  // z:125 t:225
    fb1g.x := 21;
    fb1g.y := 24;
    fb1g();                  // z:225+45= 270
    i1 := fb1g.z;
    
_GEB_ASSERT_(i1 = 270);
_GEB_ASSERT_(i2 = 280);
    
END_PROGRAM