diff --git a/.gitattributes b/.gitattributes index d2151e17a0..b4cf9adfa9 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index db1baaf72f..3f766830f2 100644 --- a/compiler/ncnv.pas +++ b/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; diff --git a/tests/webtbs/tw22502.pp b/tests/webtbs/tw22502.pp new file mode 100644 index 0000000000..1ea875b496 --- /dev/null +++ b/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. +