Browse Source

* don't ever mark the function result as vs_initialised, also not when
it is passed as a hidden parameter (mantis #20907)

git-svn-id: trunk@20373 -

Jonas Maebe 13 years ago
parent
commit
bacdd8be81
4 changed files with 31 additions and 1 deletions
  1. 2 0
      .gitattributes
  2. 2 1
      compiler/symsym.pas
  3. 16 0
      tests/webtbf/tw20907.pp
  4. 11 0
      tests/webtbf/tw20907a.pp

+ 2 - 0
.gitattributes

@@ -11287,6 +11287,8 @@ tests/webtbf/tw2070.pp svneol=native#text/plain
 tests/webtbf/tw20721a.pp svneol=native#text/pascal
 tests/webtbf/tw20721a.pp svneol=native#text/pascal
 tests/webtbf/tw20721b.pp svneol=native#text/pascal
 tests/webtbf/tw20721b.pp svneol=native#text/pascal
 tests/webtbf/tw20721c.pp svneol=native#text/pascal
 tests/webtbf/tw20721c.pp svneol=native#text/pascal
+tests/webtbf/tw20907.pp svneol=native#text/plain
+tests/webtbf/tw20907a.pp svneol=native#text/plain
 tests/webtbf/tw21087.pp svneol=native#text/plain
 tests/webtbf/tw21087.pp svneol=native#text/plain
 tests/webtbf/tw2128.pp svneol=native#text/plain
 tests/webtbf/tw2128.pp svneol=native#text/plain
 tests/webtbf/tw2129.pp svneol=native#text/plain
 tests/webtbf/tw2129.pp svneol=native#text/plain

+ 2 - 1
compiler/symsym.pas

@@ -1522,7 +1522,8 @@ implementation
     constructor tparavarsym.create(const n : string;nr:word;vsp:tvarspez;def:tdef;vopts:tvaroptions);
     constructor tparavarsym.create(const n : string;nr:word;vsp:tvarspez;def:tdef;vopts:tvaroptions);
       begin
       begin
          inherited create(paravarsym,n,vsp,def,vopts);
          inherited create(paravarsym,n,vsp,def,vopts);
-         if (vsp in [vs_var,vs_value,vs_const,vs_constref]) then
+         if (vsp in [vs_var,vs_value,vs_const,vs_constref]) and
+            not(vo_is_funcret in vopts) then
            varstate := vs_initialised;
            varstate := vs_initialised;
          paranr:=nr;
          paranr:=nr;
          paraloc[calleeside].init;
          paraloc[calleeside].init;

+ 16 - 0
tests/webtbf/tw20907.pp

@@ -0,0 +1,16 @@
+{ %opt=-vew -Sew }
+{ %fail }
+
+type
+  trec = record
+    s: set of byte;
+  end;
+
+function f: trec;
+begin
+  if f.s <>[] then ;
+end;
+
+begin
+  f;
+end.

+ 11 - 0
tests/webtbf/tw20907a.pp

@@ -0,0 +1,11 @@
+{ %opt=-vw -Sew }
+{ %fail }
+
+function f: ansistring;
+begin
+  if f <> '' then;
+end;
+
+begin
+  f;
+end.