diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-06-30 15:33:47 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-06-30 15:33:47 +0000 |
commit | 4893cc45677e0c766652016a12a8e2fa8ee005c9 (patch) | |
tree | 301b7c01cad16aaeb71a370bbd1c77fbdc4e597e /tests/webtbs/tw8975e.pp | |
parent | b45f871648418729259a99038946c09c0841ca90 (diff) | |
download | fpc-4893cc45677e0c766652016a12a8e2fa8ee005c9.tar.gz |
* converted range checking for open arrays/array of const from the code
generator to the typecheck pass, so that it also works for platforms
that use the parentfpstruct way to handle accesses to nested frames
in case the array has been migrated to such a parentfpstruct
o additionally, the number of comparisons for such range checks
has been reduced from 3 (for signed indices) or 2 (for unsigned
indices) to 1 in all cases
o the range checking code is disabled for the JVM target, as the
JVM automatically range checks all array accesses itself anyway
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@34034 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/webtbs/tw8975e.pp')
-rw-r--r-- | tests/webtbs/tw8975e.pp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/webtbs/tw8975e.pp b/tests/webtbs/tw8975e.pp new file mode 100644 index 0000000000..eabdfee848 --- /dev/null +++ b/tests/webtbs/tw8975e.pp @@ -0,0 +1,22 @@ +{ %opt=-CRriot -O-2 -Ooregvar } +{ %fail } + +{Internal FPC2.1.4 error, compile with fpc -B -dDebug -O3} +procedure bug(var b: array of longint); + + procedure intern; + begin + if (b[low(b)-1] <> 1) then {Fatal: Internal error 200409241} + halt(1); + end; +begin + intern; +end; + +const + a: array[1..3] of longint = (1,2,3); +begin + bug(a); +end. + + |