mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-30 02:40:31 +02:00
* fix wrong constant temp handling, introduced in r24953, resolves #24915
git-svn-id: trunk@25684 -
This commit is contained in:
parent
256600e5d3
commit
f95b225157
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13588,6 +13588,7 @@ tests/webtbs/tw24863.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw24865.pp svneol=native#text/pascal
|
tests/webtbs/tw24865.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw24867.pp svneol=native#text/pascal
|
tests/webtbs/tw24867.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw24871.pp svneol=native#text/pascal
|
tests/webtbs/tw24871.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw24915.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2492.pp svneol=native#text/plain
|
tests/webtbs/tw2492.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2494.pp svneol=native#text/plain
|
tests/webtbs/tw2494.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw24953.pp svneol=native#text/pascal
|
tests/webtbs/tw24953.pp svneol=native#text/pascal
|
||||||
|
@ -3814,7 +3814,7 @@ implementation
|
|||||||
if para.parasym.varspez=vs_const then
|
if para.parasym.varspez=vs_const then
|
||||||
pushconstaddr:=paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption);
|
pushconstaddr:=paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption);
|
||||||
{ check if we have to create a temp, assign the parameter's }
|
{ check if we have to create a temp, assign the parameter's }
|
||||||
{ contents to that temp and then substitute the paramter }
|
{ contents to that temp and then substitute the parameter }
|
||||||
{ with the temp everywhere in the function }
|
{ with the temp everywhere in the function }
|
||||||
if
|
if
|
||||||
((tparavarsym(para.parasym).varregable in [vr_none,vr_addr]) and
|
((tparavarsym(para.parasym).varregable in [vr_none,vr_addr]) and
|
||||||
@ -3904,20 +3904,6 @@ implementation
|
|||||||
begin
|
begin
|
||||||
tempnode := ctempcreatenode.create(para.parasym.vardef,para.parasym.vardef.size,
|
tempnode := ctempcreatenode.create(para.parasym.vardef,para.parasym.vardef.size,
|
||||||
tt_persistent,tparavarsym(para.parasym).is_regvar(false));
|
tt_persistent,tparavarsym(para.parasym).is_regvar(false));
|
||||||
|
|
||||||
{ inherit const }
|
|
||||||
if tabstractvarsym(para.parasym).varspez=vs_const then
|
|
||||||
begin
|
|
||||||
include(tempnode.tempinfo^.flags,ti_const);
|
|
||||||
|
|
||||||
{ apply less strict rules for the temp. to be a register than
|
|
||||||
ttempcreatenode does
|
|
||||||
|
|
||||||
this way, dyn. array, ansistrings etc. can be put into registers as well }
|
|
||||||
if tparavarsym(para.parasym).is_regvar(false) then
|
|
||||||
include(tempnode.tempinfo^.flags,ti_may_be_in_reg);
|
|
||||||
end;
|
|
||||||
|
|
||||||
addstatement(inlineinitstatement,tempnode);
|
addstatement(inlineinitstatement,tempnode);
|
||||||
|
|
||||||
if localvartrashing <> -1 then
|
if localvartrashing <> -1 then
|
||||||
|
19
tests/webtbs/tw24915.pp
Normal file
19
tests/webtbs/tw24915.pp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
program err;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses SysUtils;
|
||||||
|
|
||||||
|
function test(const a, b: string): string; inline;
|
||||||
|
begin
|
||||||
|
result:=b;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const path: string = 'C:\123456789012345678901234567890\test.txt';
|
||||||
|
var t: string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
t:=test(ExtractFilePath(path), ExtractFilePath(path));
|
||||||
|
writeln(stringcodepage(path));
|
||||||
|
writeln('Path: '+t);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user