Code: Select all
MODULE Test;
IMPORT SYSTEM;
VAR x: LONGINT; y: INTEGER;
BEGIN
x := SYSTEM.VAL(LONGINT, y * 2);
END Test.
Code: Select all
MODULE Test;
IMPORT SYSTEM;
VAR x: LONGINT; y: INTEGER;
BEGIN
x := SYSTEM.VAL(LONGINT, y * 2);
END Test.
already done, DevCPC486.ConvMoveJosef Templ wrote:An even more important problem is the compiler TRAP when compiling the following module:
- JosefCode: Select all
MODULE Test; IMPORT SYSTEM; VAR x: LONGINT; y: INTEGER; BEGIN x := SYSTEM.VAL(LONGINT, y * 2); END Test.
Code: Select all
ELSE
(*y.form := f;*)
IF m = Stk THEN
y.form := f;
IF ((f < Int32) OR (f = Char16)) & (y.mode # Reg) THEN LoadW(y, hint, stop) END;
Push(y)
ELSIF m # Undef THEN
y.form := f;
IF f = Int64 THEN
IF y.mode # Reg THEN LoadLong(y, hint, stop) END;
Free(y); y.form := Int32; z := x; z.form := Int32; DevCPL486.GenMove(y, z);
IF z.mode = Reg THEN ASSERT(z.reg # y.index); z.reg := z.index ELSE INC(z.offset, 4) END;
y.reg := y.index; DevCPL486.GenMove(y, z);
ELSE
IF y.mode # Reg THEN LoadW(y, hint, stop) END;
Free(y); DevCPL486.GenMove(y, x)
END
(*ELSIF (y.mode = Stk) & (y.form = Int64) & (f = Int32 )THEN (*SHORT(ENTIER(real))*)
LoadLong(y, hint, stop);
y.form := f; z:=y; z.reg:=z.index; Free(z);*)
ELSE
IF (f = Int64) & (y.mode = Reg) & ((y.form <= Int32) OR(y.form=Char16)) THEN
y.index := 2;
END;
y.form := f
END
END
END
END ConvMove;
Code: Select all
| valfn: ...
IF (x.class = Nconst) & (x.typ = p.typ) THEN (* ok *)
ELSIF (x.class >= Nconst) OR ((f IN realSet) # (p.typ.form IN realSet))
OR (DevCPM.options * {DevCPM.java, DevCPM.allSysVal} # {}) THEN
IF (p.typ.comp=Basic)&(x.typ.comp=Basic)&(p.typ.size # x.typ.size) & ((p.typ.size > 4) OR (x.typ.size > 4))THEN
DevCPM.err(220) (* 220 illegal value of parameter*);
ELSE
t := DevCPT.NewNode(Nmop); t.subcl := val; t.left := x; x := t
END;
ELSE x.readonly := FALSE;
(**)
END ;
x.typ := p.typ; p := x
| movefn: (*SYSTEM.MOVE*)
For x86, EAX register can be interpreted as EDX:EAX for LONGINT.Josef Templ wrote:Let us look at the SYSTEM.VAL(LONGINT, int reg) TRAP in the center.
A single register cannot be re-interpreted as a pair of registers.
Code: Select all
MODULE A;
IMPORT S := SYSTEM, W := WinApi, Log := StdLog;
PROCEDURE WritePoint (IN pt: W.POINT);
BEGIN
Log.Int(pt.x); Log.String(", "); Log.Int(pt.y); Log.Ln;
END WritePoint;
PROCEDURE Do* (x, y: INTEGER);
BEGIN
WritePoint(S.VAL(W.POINT, x));
END Do;
END A.
(!)"A.Do(434, 34434)"
Code: Select all
MODULE Test;
IMPORT SYSTEM;
VAR
x0: LONGINT; y0: INTEGER;
x1: BYTE; y1: REAL;
x2: INTEGER; y2: REAL;
BEGIN
x0 := SYSTEM.VAL(LONGINT, y0 * 2);
x1 := SYSTEM.VAL(BYTE, y1 * 2);
x2 := SYSTEM.VAL(INTEGER, y2 * 2);
END Test.