* fixed warnings for length/high/low(<normal array>; <ord>; <enum>)

git-svn-id: trunk@5795 -
This commit is contained in:
florian 2007-01-03 09:51:24 +00:00
parent 8bd9d88641
commit 80d4887e67
3 changed files with 34 additions and 2 deletions

1
.gitattributes vendored
View File

@ -6246,6 +6246,7 @@ tests/tbs/tb0517.pp svneol=native#text/plain
tests/tbs/tb0518.pp svneol=native#text/plain
tests/tbs/tb0519.pp svneol=native#text/plain
tests/tbs/tb0520.pp svneol=native#text/plain
tests/tbs/tb0521.pp svneol=native#text/plain
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain
tests/tbs/ub0119.pp svneol=native#text/plain

View File

@ -1111,6 +1111,7 @@ implementation
case def.typ of
orddef:
begin
set_varstate(left,vs_read,[]);
if inlinenumber=in_low_x then
v:=torddef(def).low
else
@ -1150,6 +1151,7 @@ implementation
end;
enumdef:
begin
set_varstate(left,vs_read,[]);
enum:=tenumsym(tenumdef(def).firstenum);
v:=tenumdef(def).maxval;
if inlinenumber=in_high_x then
@ -1567,7 +1569,11 @@ implementation
in_length_x:
begin
set_varstate(left,vs_read,[vsf_must_be_valid]);
if not(is_special_array(left.resultdef)) or
(left.resultdef.typ=orddef) then
set_varstate(left,vs_read,[])
else
set_varstate(left,vs_read,[vsf_must_be_valid]);
case left.resultdef.typ of
variantdef:
@ -1887,6 +1893,7 @@ implementation
begin
if inlinenumber=in_low_x then
begin
set_varstate(left,vs_read,[]);
result:=cordconstnode.create(tarraydef(
left.resultdef).lowrange,tarraydef(left.resultdef).rangedef,true);
end
@ -1912,6 +1919,7 @@ implementation
end
else
begin
set_varstate(left,vs_read,[]);
result:=cordconstnode.create(tarraydef(
left.resultdef).highrange,tarraydef(left.resultdef).rangedef,true);
end;
@ -2389,7 +2397,7 @@ implementation
inserttypeconv(hpp,resultnode.resultdef);
{ avoid any possible warnings }
inserttypeconv_internal(hpp,resultnode.resultdef);
addstatement(newstatement,cassignmentnode.create(resultnode,hpp));
{ deallocate the temp }
if assigned(tempnode) then

23
tests/tbs/tb0521.pp Normal file
View File

@ -0,0 +1,23 @@
{ %opt=-vw -Sew }
{ %norun }
procedure p;
var
c : char;
w : widechar;
a : array[0..1] of longint;
i : integer;
e : (e1,e2,e3);
begin
writeln(length(c));
writeln(length(w));
writeln(length(a));
writeln(low(i));
writeln(high(i));
writeln(ord(low(e)));
writeln(ord(high(e)));
writeln(low(a));
writeln(high(a));
end;
begin
end.