mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 17:06:14 +02:00
+ initialise managed string function results with an error string when
compiling with -gt (mantis #28948) git-svn-id: trunk@33198 -
This commit is contained in:
parent
3499c59872
commit
0e97811b50
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14927,6 +14927,7 @@ tests/webtbs/tw2891.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw28916.pp svneol=native#text/pascal
|
tests/webtbs/tw28916.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw2892.pp svneol=native#text/plain
|
tests/webtbs/tw2892.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw28934.pp svneol=native#text/plain
|
tests/webtbs/tw28934.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw28948.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw28964.pp svneol=native#text/plain
|
tests/webtbs/tw28964.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2897.pp svneol=native#text/plain
|
tests/webtbs/tw2897.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2899.pp svneol=native#text/plain
|
tests/webtbs/tw2899.pp svneol=native#text/plain
|
||||||
|
@ -443,7 +443,11 @@ implementation
|
|||||||
((vo_is_funcret in tabstractnormalvarsym(p).varoptions) or
|
((vo_is_funcret in tabstractnormalvarsym(p).varoptions) or
|
||||||
(tabstractnormalvarsym(p).varspez=vs_out)))) and
|
(tabstractnormalvarsym(p).varspez=vs_out)))) and
|
||||||
not (vo_is_default_var in tabstractnormalvarsym(p).varoptions) and
|
not (vo_is_default_var in tabstractnormalvarsym(p).varoptions) and
|
||||||
not is_managed_type(tabstractnormalvarsym(p).vardef) and
|
(not is_managed_type(tabstractnormalvarsym(p).vardef) or
|
||||||
|
(is_string(tabstractnormalvarsym(p).vardef) and
|
||||||
|
(vo_is_funcret in tabstractnormalvarsym(p).varoptions)
|
||||||
|
)
|
||||||
|
) and
|
||||||
not assigned(tabstractnormalvarsym(p).defaultconstsym);
|
not assigned(tabstractnormalvarsym(p).defaultconstsym);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -468,7 +472,19 @@ implementation
|
|||||||
the procedure address -> cast to tmethod instead }
|
the procedure address -> cast to tmethod instead }
|
||||||
trashn:=ctypeconvnode.create_explicit(trashn,methodpointertype);
|
trashn:=ctypeconvnode.create_explicit(trashn,methodpointertype);
|
||||||
end;
|
end;
|
||||||
if ((p.typ=localvarsym) and
|
if is_managed_type(p.vardef) then
|
||||||
|
begin
|
||||||
|
if is_string(p.vardef) then
|
||||||
|
trash_small(stat,trashn,
|
||||||
|
cstringconstnode.createstr(
|
||||||
|
'uninitialized function result in '+
|
||||||
|
tprocdef(p.owner.defowner).customprocname([pno_proctypeoption, pno_paranames,pno_ownername, pno_noclassmarker])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else
|
||||||
|
internalerror(2016030601);
|
||||||
|
end
|
||||||
|
else if ((p.typ=localvarsym) and
|
||||||
(not(vo_is_funcret in p.varoptions) or
|
(not(vo_is_funcret in p.varoptions) or
|
||||||
not is_shortstring(p.vardef))) or
|
not is_shortstring(p.vardef))) or
|
||||||
((p.typ=paravarsym) and
|
((p.typ=paravarsym) and
|
||||||
|
11
tests/webtbs/tw28948.pp
Normal file
11
tests/webtbs/tw28948.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ %OPT=-gt }
|
||||||
|
|
||||||
|
function f: ansistring;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
writeln(f);
|
||||||
|
if pos('uninitialized function result',f)=0 then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user