Browse Source

* correctly set expectloc for bool->cbool type conversions (mantis #22502)

git-svn-id: trunk@21973 -
Jonas Maebe 13 years ago
parent
commit
44fd18a041
3 changed files with 12 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/ncnv.pas
  3. 9 0
      tests/webtbs/tw22502.pp

+ 1 - 0
.gitattributes

@@ -12682,6 +12682,7 @@ tests/webtbs/tw22331.pp svneol=native#text/plain
 tests/webtbs/tw22344.pp svneol=native#text/plain
 tests/webtbs/tw2242.pp svneol=native#text/plain
 tests/webtbs/tw2250.pp svneol=native#text/plain
+tests/webtbs/tw22502.pp svneol=native#text/plain
 tests/webtbs/tw2259.pp svneol=native#text/plain
 tests/webtbs/tw2260.pp svneol=native#text/plain
 tests/webtbs/tw2266.pp svneol=native#text/plain

+ 2 - 1
compiler/ncnv.pas

@@ -3078,7 +3078,8 @@ implementation
     function ttypeconvnode.first_bool_to_bool : tnode;
       begin
          first_bool_to_bool:=nil;
-         if (left.expectloc in [LOC_FLAGS,LOC_JUMP]) then
+         if (left.expectloc in [LOC_FLAGS,LOC_JUMP]) and
+            not is_cbool(resultdef) then
            expectloc := left.expectloc
          else
            expectloc:=LOC_REGISTER;

+ 9 - 0
tests/webtbs/tw22502.pp

@@ -0,0 +1,9 @@
+var
+  b: Boolean;
+begin
+ b:=true;
+ b := longbool(b = b);
+ if not b then
+   halt(1);
+end.
+