* don't perform CSE on typeconversion nodes inserted for absolute

references, or anything below them (mantis #27210)

git-svn-id: trunk@31193 -
This commit is contained in:
Jonas Maebe 2015-07-04 22:28:31 +00:00
parent 1bcc276dcf
commit af2c7bf00f
3 changed files with 42 additions and 3 deletions

1
.gitattributes vendored
View File

@ -14468,6 +14468,7 @@ tests/webtbs/tw27153.pp svneol=native#text/pascal
tests/webtbs/tw27173.pp svneol=native#text/pascal
tests/webtbs/tw27185.pp svneol=native#text/pascal
tests/webtbs/tw2721.pp svneol=native#text/plain
tests/webtbs/tw27210.pp svneol=native#text/plain
tests/webtbs/tw2723.pp svneol=native#text/plain
tests/webtbs/tw2725.pp svneol=native#text/plain
tests/webtbs/tw27256.pp svneol=native#text/pascal

View File

@ -143,9 +143,16 @@ unit optcse;
{ don't add the tree below an untyped const parameter: there is
no information available that this kind of tree actually needs
to be addresable, this could be improved }
if ((n.nodetype=callparan) and
(tcallparanode(n).left.resultdef.typ=formaldef) and
(tcallparanode(n).parasym.varspez=vs_const)) then
{ the nodes below a type conversion node created for an absolute
reference cannot be handled separately, because the absolute reference
may have special requirements (no regability, must be in memory, ...)
}
if (((n.nodetype=callparan) and
(tcallparanode(n).left.resultdef.typ=formaldef) and
(tcallparanode(n).parasym.varspez=vs_const)) or
((n.nodetype=typeconvn) and
(nf_absolute in n.flags))
) then
begin
result:=fen_norecurse_false;
exit;

31
tests/webtbs/tw27210.pp Executable file
View File

@ -0,0 +1,31 @@
{$mode delphi}
program TestAbsolute; {$apptype console}
function IsInt16 (L : longint) : boolean;
var W : smallint absolute L;
begin
Result := longint (W) = L;
end;
function IsInt32 (Q : int64) : boolean;
var L : longint absolute Q;
begin
Result := int64 (L) = Q;
end;
const VL1 : longint = -1;
VL2 : longint = $12345678;
VQ1 : int64 = -1;
VQ2 : int64 = $123456781234;
begin
if not IsInt16 (VL1) then
halt(1);
if IsInt16 (VL2) then
halt(2);
if not IsInt32 (VQ1) then
halt(3);
if IsInt32 (VQ2) then
halt(4);
end.