fpc/tests/test/cg/taddint.pp
Jonas Maebe 97f4c0a130 * call taddnode.simplify at the very end of taddnode.pass_typecheck, so
it doesn't have to duplicate any type checking code, and so constant
    expressions get the same resultdefs as non-constant expressions
  * properly fixed resultdef determination of "set + setelementn" (follows
    same rules now as "set + set")
  * also convert "longint or/xor cardinal" to int64 (needed for correct
    results with negative numbers and Delphi-compatible) + test
  * extended 64-to-32 type conversion simplification to also handle
    or/xor nodes (so if the result is typecasted back to 32 bit, the
    evaluation can still be done entirely in 32 bit). These changes also
    enable that optimization in some extra cases (not just anymore for
    expressions containing only uint32)

git-svn-id: trunk@10418 -
2008-03-01 20:48:50 +00:00

34 lines
414 B
ObjectPascal

var
b: byte;
s: shortint;
l: longint;
c: cardinal;
i: int64;
begin
b:=10;
s:=-128;
l:=b or s;
writeln(l);
if (l<>-118) then
halt(1);
l:=b xor s;
writeln(l);
if (l<>-118) then
halt(2);
b:=129;
s:=-127;
l:=b and s;
writeln(l);
if (l<>129) then
halt(3);
l:=s and b;
writeln(l);
if (l<>129) then
halt(4);
l:=-127;
c:=129;
i:=l and c;
writeln(i);
end.