From 761f2e5c931478db309b81a3bde11069ab542a28 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 6 Mar 2008 20:29:27 +0000 Subject: [PATCH] * fixed constant evaluation of not(byte/word/long/quadbool) + test git-svn-id: trunk@10450 - --- compiler/nmat.pas | 2 ++ tests/test/cg/tnot.pp | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/nmat.pas b/compiler/nmat.pas index 3906ab8fed..16c6cc8302 100644 --- a/compiler/nmat.pas +++ b/compiler/nmat.pas @@ -790,6 +790,8 @@ implementation bool64bit: begin v:=byte(not(boolean(int64(v)))); + if (torddef(left.resultdef).ordtype<>pasbool) then + v:=-v; end; uchar, uwidechar, diff --git a/tests/test/cg/tnot.pp b/tests/test/cg/tnot.pp index 597ec908ce..343ad84dbb 100644 --- a/tests/test/cg/tnot.pp +++ b/tests/test/cg/tnot.pp @@ -62,7 +62,8 @@ begin writeln('Passed!'); end; - +const + lb = longbool(false); var longres : longint; @@ -145,6 +146,10 @@ Begin Write('Value should be FALSE...'); test(ord(byteboolres),0); + longboolres:=not(lb); + Write('Value should be $ffffffff...'); + test(ord(longboolres),-1); + { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } { CURRENT_NODE : LOC_JUMP } { ???????????????????????}