mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 02:59:21 +02:00
* fixed tcasenode.simplify() in case we have to pass via a "less" branch of
of a tcaselabel that also has a valid "greater" branch to arrive at the correct entry (mantis #30522) git-svn-id: trunk@34379 -
This commit is contained in:
parent
deda4c8247
commit
3669419bb3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15207,6 +15207,7 @@ tests/webtbs/tw30431.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw30443.pp svneol=native#text/plain
|
tests/webtbs/tw30443.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3045.pp svneol=native#text/plain
|
tests/webtbs/tw3045.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3048.pp svneol=native#text/plain
|
tests/webtbs/tw3048.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw30522.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3063.pp svneol=native#text/plain
|
tests/webtbs/tw3063.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3064.pp svneol=native#text/plain
|
tests/webtbs/tw3064.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3073.pp svneol=native#text/plain
|
tests/webtbs/tw3073.pp svneol=native#text/plain
|
||||||
|
@ -873,14 +873,12 @@ implementation
|
|||||||
function tcasenode.simplify(forinline:boolean):tnode;
|
function tcasenode.simplify(forinline:boolean):tnode;
|
||||||
var
|
var
|
||||||
tmp: pcaselabel;
|
tmp: pcaselabel;
|
||||||
walkup: boolean;
|
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
if left.nodetype=ordconstn then
|
if left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
tmp:=labels;
|
tmp:=labels;
|
||||||
{ check all case labels until we find one that fits }
|
{ check all case labels until we find one that fits }
|
||||||
walkup:=assigned(tmp^.greater);
|
|
||||||
while assigned(tmp) do
|
while assigned(tmp) do
|
||||||
begin
|
begin
|
||||||
if (tmp^._low<=tordconstnode(left).value) and
|
if (tmp^._low<=tordconstnode(left).value) and
|
||||||
@ -895,7 +893,7 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if walkup then
|
if tmp^._high<tordconstnode(left).value then
|
||||||
tmp:=tmp^.greater
|
tmp:=tmp^.greater
|
||||||
else
|
else
|
||||||
tmp:=tmp^.less;
|
tmp:=tmp^.less;
|
||||||
|
26
tests/webtbs/tw30522.pp
Normal file
26
tests/webtbs/tw30522.pp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
type
|
||||||
|
E = ( a, b, c );
|
||||||
|
|
||||||
|
begin
|
||||||
|
case b of
|
||||||
|
a: begin
|
||||||
|
write( 'a' );
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
c: begin
|
||||||
|
write( 'c' );
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
b:
|
||||||
|
begin
|
||||||
|
write( 'b' );
|
||||||
|
halt(0);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
write( '?' );
|
||||||
|
halt(3);
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user