VAR
global: INTEGER;
PROCEDURE UseGlobal*; (** check whether usage of global parameter is listed as additional (in-) parameter *)
VAR local: INTEGER;
BEGIN
local := global
END UseGlobal;
PROCEDURE CallUseGlobal*;
VAR local: INTEGER;
BEGIN
local := 0;
UseGlobal;
local := local (* check whether called procedure is not included into slice *)
END CallUseGlobal;
PROCEDURE DefGlobal*; (** check whether def of global parameter is listed as additional (out-) parameter *)
VAR local: INTEGER;
BEGIN
global := local
END DefGlobal;
PROCEDURE CallDefGlobal*;
VAR local: INTEGER;
BEGIN
local := 0;
DefGlobal;
local := local; (* check whether called procedure is not included into slice *)
global := global (* check whether called procedure is included into slice *)
END CallDefGlobal;
PROCEDURE UseDefGlobal*; (** check whether access to global parameter is listed as additional parameter *)
BEGIN
INC(global)
END UseDefGlobal;
PROCEDURE CallUseDefGlobal*;
VAR local: INTEGER;
BEGIN
local := 0;
UseDefGlobal;
local := local; (* check whether called procedure is not included into slice *)
global := global (* check whether called procedure is included into slice *)
END CallUseDefGlobal;
PROCEDURE UseValuePar* (i: INTEGER); (** checks usage of value parameter *)
VAR local: INTEGER;
BEGIN
local := i
END UseValuePar;
PROCEDURE CallUseValuePar*;
VAR local: INTEGER;
BEGIN
local := 0;
UseValuePar(local);
local := local (* check whether called procedure is not included into slice *)
END CallUseValuePar;
PROCEDURE UseVarPar* (VAR i: INTEGER); (** checks usage of reference parameter *)
VAR local: INTEGER;
BEGIN
local := i
END UseVarPar;
PROCEDURE DefValuePar* (i: INTEGER); (** checks def of value parameter *)
BEGIN
i := 1
END DefValuePar;
PROCEDURE DefVarPar* (VAR i: INTEGER); (** checks def of reference parameter *)
BEGIN
i := 1
END DefVarPar;
PROCEDURE UseDefValuePar* (i: INTEGER); (** checks access to value parameter *)
BEGIN
INC(i)
END UseDefValuePar;
PROCEDURE UseDefVarPar* (VAR i: INTEGER); (** checks access to reference parameter *)
BEGIN
INC(i)
END UseDefVarPar;
PROCEDURE UseValueParSometimes* (i: INTEGER); (** checks usage of value parameter *)
VAR local: INTEGER;
BEGIN
IF global = 0THEN
local := i
END
END UseValueParSometimes;
PROCEDURE UseVarParSometimes* (VAR i: INTEGER); (** checks usage of reference parameter *)
VAR local: INTEGER;
BEGIN
IF global = 0 THEN
local := i
END
END UseVarParSometimes;
PROCEDURE DefValueParSometimes* (i: INTEGER); (** checks def of value parameter *)
BEGIN
IF global = 0 THEN
i := 1
END
END DefValueParSometimes;
PROCEDURE DefVarParSometimes* (VAR i: INTEGER); (** checks def of reference parameter *)
BEGIN
IF global = 0 THEN
i := 1
END
END DefVarParSometimes;
PROCEDURE UseDefValueParSometimes* (i: INTEGER); (** checks access to value parameter *)
BEGIN
IF global = 0 THEN
INC(i)
END
END UseDefValueParSometimes;
PROCEDURE UseDefVarParSometimes* (VAR i: INTEGER); (** checks access to reference parameter *)
BEGIN
IF global = 0 THEN
INC(i)
END
END UseDefVarParSometimes;
PROCEDURE CallLocal*; (** checks whether accesses to global variables is propagated along recursion chains *)
PROCEDURE Local;
BEGIN
CallLocal (* calls the calling procedure recursively *)
END Local;
BEGIN
DefGlobal; (* defines a global variable *)
Local (* calls local procedure which in turn calls the calling procedure recursively *)
END CallLocal;
PROCEDURE^ TestIndirectRecursion2*;
PROCEDURE TestIndirectRecursion1*;
BEGIN
TestIndirectRecursion2
END TestIndirectRecursion1;
PROCEDURE TestIndirectRecursion2*;
BEGIN
DefGlobal;
TestIndirectRecursion1
END TestIndirectRecursion2;
PROCEDURE CallProc; (** check whether position of actual parameter (conval.intval/intval2) are correct *)
VAR i: INTEGER;
BEGIN
i := 0;
DefVarPar(i);
i := i
END CallProc;
END TestCall.