* also give a "potential range error" hint with -CO in case the sizes

match but the source range does not fit in the dest range
    (related to mantis #16023)
  * don't give a "potential range error" when converting between
    s80real and sc80real, since even though the size may differ,
    the represented range does not

git-svn-id: trunk@15044 -
This commit is contained in:
Jonas Maebe 2010-03-24 21:21:19 +00:00
parent 8542632ebe
commit 653974f679
3 changed files with 20 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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)

10
tests/webtbf/tw16203.pp Normal file
View File

@ -0,0 +1,10 @@
{ %OPT=-vh -Seh }
{ %fail }
var
B : Byte;
s: shortint;
begin
b:=255;
s:=b;
end.