diff --git a/.gitattributes b/.gitattributes index 59adeb92d6..0a1223de57 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9649,6 +9649,7 @@ tests/webtbf/tw15777b.pp svneol=native#text/plain tests/webtbf/tw1599.pp svneol=native#text/plain tests/webtbf/tw1599b.pp svneol=native#text/plain tests/webtbf/tw16022.pp svneol=native#text/plain +tests/webtbf/tw16203.pp svneol=native#text/plain tests/webtbf/tw1633.pp svneol=native#text/plain tests/webtbf/tw1642.pp svneol=native#text/plain tests/webtbf/tw1655.pp svneol=native#text/plain diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 0546b85e61..d4072e8a5c 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -2708,7 +2708,15 @@ implementation not is_boolean(source.resultdef) and not is_constrealnode(source) then begin - if (destdef.size < source.resultdef.size) then + if ((destdef.size < source.resultdef.size) and + { s80real and sc80real have a different size but the same precision } + not((destdef.typ=floatdef) and + (source.resultdef.typ=floatdef) and + (tfloatdef(source.resultdef).floattype in [s80real,sc80real]) and + (tfloatdef(destdef).floattype in [s80real,sc80real]))) or + ((destdef.typ<>floatdef) and + (source.resultdef.typ<>floatdef) and + not is_in_limit(source.resultdef,destdef)) then begin if (cs_check_range in current_settings.localswitches) then MessagePos(location,type_w_smaller_possible_range_check) diff --git a/tests/webtbf/tw16203.pp b/tests/webtbf/tw16203.pp new file mode 100644 index 0000000000..be7152ccd9 --- /dev/null +++ b/tests/webtbf/tw16203.pp @@ -0,0 +1,10 @@ +{ %OPT=-vh -Seh } +{ %fail } + +var + B : Byte; + s: shortint; +begin + b:=255; + s:=b; +end.