Hello, Mike.

I added a print X(100) following the Call in P1 and that fails too.

I suppose that the X(100) element is being cleared before the assignment
of A. However, as A is a pointer to X(100), both become cleared.

Perhaps the move_matrix op-code should test if the r-value (e.g. A)
resolves to the same l-value element (e.g. X(100)) and treat the
statement as a no-op in such cases. 

One can short-circuit the problem by adding an intermediate variable,
such as, C = A; X(100) = C, in P2.

Interesting puzzle. I wonder if there is a GTAR on this?

Best regards,
Gyle

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Mike Rajkowski
Sent: Tuesday, February 17, 2004 9:17 AM
To: U2 Users Discussion List
Subject: Need/Want/Would like to know


Someone came to me with the following code sample, and asked why this
would happen, while I have some thoughts, I would like a more definitive
answer (note no matter what the answer, I believe the solution is don't
do that....)

Thanks,
Mike

On Universe 9.5:

04 ED BP P1 P2

SELECTed record name = "P1".
6 lines long.

----: P
0001: *
0002: DIM X(100)
0003: MAT X = ""
0004: X(100) = 1
0005: CALL P2(X(100), MAT X)
0006: END
Bottom at line 6.
----: EX

SELECTed record name = "P2".
13 lines long.

----: P
0001: SUBROUTINE P2(A, MAT X)
0002: DIM X(100)
0003: CRT 'A = ':A
0004: CRT 'X(100) = ':X(100)
0005: *
0006: CRT ; CRT "SETTING X(100) = A"
0007: X(100) = A
0008: CRT ; CRT "NOW RE-CHECKING THE VALUES"
0009: *
0010: CRT 'A = ':A
0011: CRT 'X(100) = ':X(100)
0012: RETURN
0013: END
Bottom at line 13.
----: EX

File name        = BP
Record name = 
>RUN BP P1
A = 1
X(100) = 1

SETTING X(100) = A

NOW RE-CHECKING THE VALUES
A = Program "P2": Line 10, Variable "A" previously undefined.  Empty
string used
.

X(100) = Program "P2": Line 11, Variable "$R0" previously undefined.
Empty stri
ng used.

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to