86 lines
1.5 KiB
Plaintext
86 lines
1.5 KiB
Plaintext
-- This file tests passing (plain and array) variables to functions
|
|
-- Four unknown variables are available; x, y, z.
|
|
-- Two arrays are automatically declared; a (size 10) and b (size 12)
|
|
|
|
PROC pR(VAL INT n)
|
|
SKIP
|
|
:
|
|
|
|
PROC pRRW(VAL INT n, VAL INT o, INT p)
|
|
SKIP
|
|
:
|
|
|
|
PROC pRWW(VAL INT n, INT o, INT p)
|
|
SKIP
|
|
:
|
|
|
|
INT,INT FUNCTION fRR(VAL INT m, VAL INT n)
|
|
VALOF
|
|
SKIP
|
|
RESULT m,n
|
|
:
|
|
|
|
PROC p(INT x, y, z)
|
|
[10]INT a:
|
|
[12]INT b:
|
|
INT q, w:
|
|
%%
|
|
:
|
|
|
|
PROC m()
|
|
SKIP
|
|
:
|
|
|
|
%PASS Distinct plain variables passed to one call (#1)
|
|
pRRW(x,y,z)
|
|
|
|
%PASS Distinct plain variables passed to one call (#2)
|
|
pRWW(x,y,z)
|
|
|
|
%PASS Safely overlapping plain variables passed to one call
|
|
pRRW(x,x,z)
|
|
|
|
%FAIL Risky overlapping plain variables passed to one call (#1)
|
|
pRRW(x,y,x)
|
|
|
|
%FAIL Risky overlapping plain variables passed to one call (#2)
|
|
pRWW(x,y,y)
|
|
|
|
%FAIL Risky overlapping plain variables passed to one call (#3)
|
|
pRWW(x,y,x)
|
|
|
|
%PASS Safely overlapping plain variables passed to two calls
|
|
PAR
|
|
pRRW(x,x,z)
|
|
pRRW(x,x,y)
|
|
|
|
%FAIL Risky overlapping plain variables passed to two calls (#1)
|
|
PAR
|
|
pRRW(x,y,z)
|
|
pRRW(x,y,z)
|
|
|
|
%FAIL Risky overlapping plain variables passed to two calls (#2)
|
|
PAR
|
|
pRRW(x,y,z)
|
|
pRRW(z,y,x)
|
|
|
|
%FAIL Risky overlapping plain variables passed to two calls (#3)
|
|
PAR
|
|
pRRW(x,y,z)
|
|
pRWW(x,y,z)
|
|
|
|
%PASS Safe overlapping function calls
|
|
PAR
|
|
y, q := fRR(y,z)
|
|
x, w := fRR(x,z)
|
|
|
|
%FAIL Risky overlapping function calls
|
|
PAR
|
|
x, q := fRR(y,z)
|
|
y, w := fRR(x,z)
|
|
|
|
|
|
-- TODO array versions of these
|
|
|
|
%
|