The easy-to-avoid problem of aliasing occurs when a global variable appears as an actual parameter in a subprogram call and then is referenced within the subprogram. The result is indeterminate because it depends on the method of parameter passing chosen by the compiler. Consider the following example:
DECLARE
rent REAL;
PROCEDURE raise_rent (increase IN OUT REAL) IS
BEGIN
rent := rent + increase;
/* At this point, if the compiler passed the address
of the actual parameter to the subprogram, the same
variable has two names. Thus, the term 'aliasing'. */
...
END raise_rent;
...
BEGIN
...
raise_rent(rent); -- indeterminateAliasing also occurs when the same actual parameter appears twice in a subprogram call. Unless both formal parameters are IN parameters, the result is indeterminate, as the following example shows:
DECLARE
str VARCHAR2(10);
PROCEDURE reverse (in_str VARCHAR2, out_str OUT VARCHAR2) IS
BEGIN
/* Reverse order of characters in string here. */
...
/* At this point, whether the value of in_str
is 'abcd' or 'dcba' depends on the methods of
parameter passing chosen by the compiler. */
END reverse;
...
BEGIN
str := 'abcd';
reverse(str, str); -- indeterminate