Pārlūkot izejas kodu

- disable inlining for procedures with a formal const parameter, fixes
webtbs/tw4427

git-svn-id: trunk@1390 -

Jonas Maebe 20 gadi atpakaļ
vecāks
revīzija
810ec85e34
3 mainītis faili ar 21 papildinājumiem un 1 dzēšanām
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/psub.pas
  3. 19 0
      tests/webtbs/tw4427.pp

+ 1 - 0
.gitattributes

@@ -6318,6 +6318,7 @@ tests/webtbs/tw4350.pp svneol=native#text/plain
 tests/webtbs/tw4388.pp svneol=native#text/plain
 tests/webtbs/tw4390.pp svneol=native#text/plain
 tests/webtbs/tw4398.pp svneol=native#text/plain
+tests/webtbs/tw4427.pp svneol=native#text/plain
 tests/webtbs/tw4428.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain

+ 1 - 1
compiler/psub.pas

@@ -972,7 +972,7 @@ implementation
             { we can't handle formaldefs and special arrays (the latter may need a    }
             { re-basing of the index, i.e. if you pass an array[1..10] as open array, }
             { you have to add 1 to all index operations if you directly inline it     }
-            if ((currpara.varspez in [vs_out,vs_var]) and
+            if ((currpara.varspez in [vs_out,vs_var,vs_const]) and
                 (currpara.vartype.def.deftype=formaldef)) or
                is_special_array(currpara.vartype.def)  then
               exit;

+ 19 - 0
tests/webtbs/tw4427.pp

@@ -0,0 +1,19 @@
+{$inline on}
+
+type
+  pbyte = ^byte;
+
+procedure test(p: pchar);
+begin
+  if pbyte(p)^ <> 0 then
+    halt(1);
+end;
+
+procedure test(const p); inline;
+begin
+  test(pchar(@p));
+end;
+
+begin
+  test(#0);
+end.