mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 06:59:26 +02:00
* do not apply range test optimization if the variable is a string being compared against a char constants, resolves #37476
git-svn-id: trunk@46453 -
This commit is contained in:
parent
7e8b9122dd
commit
18b8b9c566
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16559,6 +16559,7 @@ tests/webtbf/tw3740.pp svneol=native#text/plain
|
||||
tests/webtbf/tw37460.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw37462.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw37475.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw37476.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw3790.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3812.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3930a.pp svneol=native#text/plain
|
||||
|
@ -1326,7 +1326,9 @@ implementation
|
||||
(right.nodetype in [ltn,lten,gtn,gten]) and
|
||||
(not might_have_sideeffects(left)) and
|
||||
(not might_have_sideeffects(right)) and
|
||||
is_range_test(taddnode(left),taddnode(right),vl,cl,cr) then
|
||||
is_range_test(taddnode(left),taddnode(right),vl,cl,cr) and
|
||||
{ avoid optimization being applied to (<string. var > charconst1) and (<string. var < charconst2) }
|
||||
(vl.resultdef.typ in [orddef,enumdef]) then
|
||||
begin
|
||||
hdef:=get_unsigned_inttype(vl.resultdef);
|
||||
vl:=ctypeconvnode.create_internal(vl.getcopy,hdef);
|
||||
@ -3000,7 +3002,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
if not codegenerror and
|
||||
if (errorcount=0) and
|
||||
not assigned(result) then
|
||||
result:=simplify(false);
|
||||
end;
|
||||
|
5
tests/webtbf/tw37476.pp
Normal file
5
tests/webtbf/tw37476.pp
Normal file
@ -0,0 +1,5 @@
|
||||
{ %fail }
|
||||
var a : string = (a >= 'A') and (a <= 'F');
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user