mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 10:09:22 +02:00
* avoid range check errors when inlining not-nodes (mantis #21029)
git-svn-id: trunk@20046 -
This commit is contained in:
parent
ad2aa1ceb3
commit
3b8ae840c1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12112,6 +12112,7 @@ tests/webtbs/tw20962.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw20995a.pp svneol=native#text/pascal
|
tests/webtbs/tw20995a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20995b.pp svneol=native#text/pascal
|
tests/webtbs/tw20995b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw20998.pp svneol=native#text/pascal
|
tests/webtbs/tw20998.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw21029.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2109.pp svneol=native#text/plain
|
tests/webtbs/tw2109.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2110.pp svneol=native#text/plain
|
tests/webtbs/tw2110.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2128.pp svneol=native#text/plain
|
tests/webtbs/tw2128.pp svneol=native#text/plain
|
||||||
|
@ -1003,10 +1003,21 @@ implementation
|
|||||||
else
|
else
|
||||||
CGMessage(type_e_mismatch);
|
CGMessage(type_e_mismatch);
|
||||||
end;
|
end;
|
||||||
if not forinline then
|
{ not-nodes are not range checked by the code generator -> also
|
||||||
|
don't range check while inlining; the resultdef is a bit tricky
|
||||||
|
though: the node's resultdef gets changed in most cases compared
|
||||||
|
to left, but the not-operation itself is caried out in the code
|
||||||
|
generator using the size of left
|
||||||
|
}
|
||||||
|
if not(forinline) then
|
||||||
t:=cordconstnode.create(v,def,false)
|
t:=cordconstnode.create(v,def,false)
|
||||||
else
|
else
|
||||||
t:=create_simplified_ord_const(v,resultdef,true);
|
begin
|
||||||
|
{ cut off the value if necessary }
|
||||||
|
t:=cordconstnode.create(v,left.resultdef,false);
|
||||||
|
{ now convert to node's resultdef }
|
||||||
|
inserttypeconv_explicit(t,def);
|
||||||
|
end;
|
||||||
result:=t;
|
result:=t;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
12
tests/webtbs/tw21029.pp
Normal file
12
tests/webtbs/tw21029.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{$r+}
|
||||||
|
{$inline on}
|
||||||
|
|
||||||
|
function F(y : byte) : byte; inline;
|
||||||
|
begin
|
||||||
|
f:=byte(not y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
if F(1)<>254 then
|
||||||
|
halt(1);
|
||||||
|
END.
|
Loading…
Reference in New Issue
Block a user