mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-12 19:45:56 +02:00
* don't range pointers converted to arrays, resolves #8191
git-svn-id: trunk@8900 -
This commit is contained in:
parent
6b8466633e
commit
ae79ef2cb5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8384,6 +8384,7 @@ tests/webtbs/tw8177a.pp -text
|
|||||||
tests/webtbs/tw8180.pp svneol=native#text/plain
|
tests/webtbs/tw8180.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8183.pp svneol=native#text/plain
|
tests/webtbs/tw8183.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8187.pp svneol=native#text/plain
|
tests/webtbs/tw8187.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw8191.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8195a.pp svneol=native#text/plain
|
tests/webtbs/tw8195a.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8195b.pp svneol=native#text/plain
|
tests/webtbs/tw8195b.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw8199.pp svneol=native#text/plain
|
tests/webtbs/tw8199.pp svneol=native#text/plain
|
||||||
|
@ -720,7 +720,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if not(is_open_array(left.resultdef)) and
|
if not(is_open_array(left.resultdef)) and
|
||||||
not(is_array_of_const(left.resultdef)) and
|
not(is_array_of_const(left.resultdef)) and
|
||||||
not(is_dynamic_array(left.resultdef)) then
|
not(is_dynamic_array(left.resultdef)) and
|
||||||
|
not(ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions) then
|
||||||
begin
|
begin
|
||||||
if (tordconstnode(right).value.svalue>tarraydef(left.resultdef).highrange) or
|
if (tordconstnode(right).value.svalue>tarraydef(left.resultdef).highrange) or
|
||||||
(tordconstnode(right).value.svalue<tarraydef(left.resultdef).lowrange) then
|
(tordconstnode(right).value.svalue<tarraydef(left.resultdef).lowrange) then
|
||||||
|
37
tests/webtbs/tw8191.pp
Normal file
37
tests/webtbs/tw8191.pp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
program PCharRangeChecking;
|
||||||
|
|
||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
|
||||||
|
{$ifdef fpc}
|
||||||
|
{$mode delphi}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$R+}
|
||||||
|
|
||||||
|
function Test: Boolean;
|
||||||
|
var
|
||||||
|
s: shortstring;
|
||||||
|
p: PChar;
|
||||||
|
begin
|
||||||
|
s := '1234567890';
|
||||||
|
p := PChar(@s[1]);
|
||||||
|
Inc(p,4);
|
||||||
|
|
||||||
|
Result :=
|
||||||
|
(p[-4] = '1') and
|
||||||
|
(p[-3] = '2') and
|
||||||
|
(p[-2] = '3') and
|
||||||
|
(p[-1] = '4') and
|
||||||
|
(p[ 0] = '5') and
|
||||||
|
(p[ 1] = '6') and
|
||||||
|
(p[ 2] = '7') and
|
||||||
|
(p[ 3] = '8') and
|
||||||
|
(p[ 4] = '9') and
|
||||||
|
(p[ 5] = '0');
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not Test then
|
||||||
|
halt(1);
|
||||||
|
WriteLn('ok');
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user