Browse Source

* fixed constant evaluation of not(byte/word/long/quadbool) + test

git-svn-id: trunk@10450 -
Jonas Maebe 17 years ago
parent
commit
761f2e5c93
2 changed files with 8 additions and 1 deletions
  1. 2 0
      compiler/nmat.pas
  2. 6 1
      tests/test/cg/tnot.pp

+ 2 - 0
compiler/nmat.pas

@@ -790,6 +790,8 @@ implementation
                bool64bit:
                bool64bit:
                  begin
                  begin
                    v:=byte(not(boolean(int64(v))));
                    v:=byte(not(boolean(int64(v))));
+                   if (torddef(left.resultdef).ordtype<>pasbool) then
+                     v:=-v;
                  end;
                  end;
                uchar,
                uchar,
                uwidechar,
                uwidechar,

+ 6 - 1
tests/test/cg/tnot.pp

@@ -62,7 +62,8 @@ begin
     writeln('Passed!');
     writeln('Passed!');
 end;
 end;
 
 
-
+const
+  lb = longbool(false);
 
 
 var
 var
  longres :  longint;
  longres :  longint;
@@ -145,6 +146,10 @@ Begin
    Write('Value should be FALSE...');
    Write('Value should be FALSE...');
    test(ord(byteboolres),0);
    test(ord(byteboolres),0);
 
 
+  longboolres:=not(lb);
+  Write('Value should be $ffffffff...');
+  test(ord(longboolres),-1);
+
   { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
   { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
   { CURRENT_NODE : LOC_JUMP }
   { CURRENT_NODE : LOC_JUMP }
   { ???????????????????????}
   { ???????????????????????}