diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2005-12-10 17:01:07 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2005-12-10 17:01:07 +0000 |
commit | 66311f4be7c24a4892215ef612aa076a17044f08 (patch) | |
tree | 56bd53db7affccd62e4024e56df029a7d09bb03a /tests/test/tinline6.pp | |
parent | 9384254e2e1cac2345125a73107eec0f6cad6a35 (diff) | |
download | fpc-66311f4be7c24a4892215ef612aa076a17044f08.tar.gz |
* use more precise vs_* information to replace less parameters of inlined
procedures with const and value parameters with temps, allowing a bit
more value propagation
+ tinline6.pp for testing wrong propagation of value parameters in
dangerous situations
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@1914 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/test/tinline6.pp')
-rw-r--r-- | tests/test/tinline6.pp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test/tinline6.pp b/tests/test/tinline6.pp new file mode 100644 index 0000000000..acbfc39bfa --- /dev/null +++ b/tests/test/tinline6.pp @@ -0,0 +1,43 @@ +{$inline on} +{$mode objfpc} + +type + tc = class + lf: longint; + procedure t(l: longint); inline; + end; + +var + a: longint; + +procedure tc.t(l: longint); inline; +begin + lf := 10; + if (l <> 5) then + begin + writeln('error class'); + halt(1); + end; +end; + + +procedure t(l: longint); inline; +begin + a := 10; + if (l <> 5) then + begin + writeln('error proc'); + halt(1); + end; +end; + +var + c: tc; + +begin + c := tc.create; + c.lf := 5; + c.t(c.lf); + a := 5; + t(a); +end. |