mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 23:09:28 +02:00
* don't trash reference counted types with -gt (mantis 8183)
git-svn-id: trunk@6149 -
This commit is contained in:
parent
6db1d75fd8
commit
fcb128c66c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7991,6 +7991,7 @@ tests/webtbs/tw8150a.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw8150d.pp svneol=native#text/plain
|
tests/webtbs/tw8150d.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8155.pp svneol=native#text/plain
|
tests/webtbs/tw8155.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8156.pp svneol=native#text/plain
|
tests/webtbs/tw8156.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw8183.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||||
tests/webtbs/uw0555.pp svneol=native#text/plain
|
tests/webtbs/uw0555.pp svneol=native#text/plain
|
||||||
|
@ -963,9 +963,10 @@ implementation
|
|||||||
trashintval: aint;
|
trashintval: aint;
|
||||||
list: TAsmList absolute arg;
|
list: TAsmList absolute arg;
|
||||||
begin
|
begin
|
||||||
if (tsym(p).typ=localvarsym) or
|
if ((tsym(p).typ=localvarsym) or
|
||||||
((tsym(p).typ=paravarsym) and
|
((tsym(p).typ=paravarsym) and
|
||||||
(vo_is_funcret in tparavarsym(p).varoptions)) then
|
(vo_is_funcret in tparavarsym(p).varoptions))) and
|
||||||
|
not(tabstractnormalvarsym(p).vardef.needs_inittable) then
|
||||||
begin
|
begin
|
||||||
trashintval := trashintvalues[localvartrashing];
|
trashintval := trashintvalues[localvartrashing];
|
||||||
case tabstractnormalvarsym(p).initialloc.loc of
|
case tabstractnormalvarsym(p).initialloc.loc of
|
||||||
@ -1140,7 +1141,6 @@ implementation
|
|||||||
if (tsym(p).typ=paravarsym) then
|
if (tsym(p).typ=paravarsym) then
|
||||||
begin
|
begin
|
||||||
needs_inittable :=
|
needs_inittable :=
|
||||||
not is_class_or_interface(tparavarsym(p).vardef) and
|
|
||||||
tparavarsym(p).vardef.needs_inittable;
|
tparavarsym(p).vardef.needs_inittable;
|
||||||
case tparavarsym(p).varspez of
|
case tparavarsym(p).varspez of
|
||||||
vs_value :
|
vs_value :
|
||||||
@ -1158,6 +1158,7 @@ implementation
|
|||||||
cg.a_load_loc_reg(list,OS_ADDR,tparavarsym(p).initialloc,tmpreg);
|
cg.a_load_loc_reg(list,OS_ADDR,tparavarsym(p).initialloc,tmpreg);
|
||||||
reference_reset_base(href,tmpreg,0);
|
reference_reset_base(href,tmpreg,0);
|
||||||
if (localvartrashing <> -1) and
|
if (localvartrashing <> -1) and
|
||||||
|
not(needs_inittable) and
|
||||||
{ needs separate implementation to trash open arrays }
|
{ needs separate implementation to trash open arrays }
|
||||||
{ since their size is only known at run time }
|
{ since their size is only known at run time }
|
||||||
not is_special_array(tparavarsym(p).vardef) then
|
not is_special_array(tparavarsym(p).vardef) then
|
||||||
@ -1167,6 +1168,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
else if (localvartrashing <> -1) and
|
else if (localvartrashing <> -1) and
|
||||||
|
not(needs_inittable) and
|
||||||
([vo_is_funcret,vo_is_hidden_para] * tparavarsym(p).varoptions = [vo_is_funcret,vo_is_hidden_para]) then
|
([vo_is_funcret,vo_is_hidden_para] * tparavarsym(p).varoptions = [vo_is_funcret,vo_is_hidden_para]) then
|
||||||
begin
|
begin
|
||||||
tmpreg:=cg.getaddressregister(list);
|
tmpreg:=cg.getaddressregister(list);
|
||||||
|
21
tests/webtbs/tw8183.pp
Normal file
21
tests/webtbs/tw8183.pp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{ %opt=-gt }
|
||||||
|
|
||||||
|
program test;
|
||||||
|
|
||||||
|
{$MODE OBJFPC}
|
||||||
|
|
||||||
|
type
|
||||||
|
xstr = interface(iunknown) end;
|
||||||
|
|
||||||
|
operator := (a: integer): xstr;
|
||||||
|
begin
|
||||||
|
if ptruint(result) <> ptruint(nil) then
|
||||||
|
halt(1);
|
||||||
|
pointer(result) := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
x: xstr;
|
||||||
|
begin
|
||||||
|
x := 42;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user