mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-01 08:26:16 +02:00
* do not swap left/right code generation for assignment nodes if
conditional expressions are involved, resolves #38129 git-svn-id: trunk@49095 -
This commit is contained in:
parent
c8c6e647be
commit
cc64d9eb4e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18720,6 +18720,7 @@ tests/webtbs/tw38074.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw38083.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw38122.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw38122b.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw38129.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3814.pp svneol=native#text/plain
|
||||
tests/webtbs/tw38145a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw38145b.pp svneol=native#text/pascal
|
||||
|
@ -718,10 +718,13 @@ implementation
|
||||
empty value is assigned
|
||||
|
||||
But not when the result is in the flags, then
|
||||
loading the left node afterwards can destroy the flags.
|
||||
loading the left node afterwards can destroy the flags.
|
||||
|
||||
Neither if right contains conditional nodes: this might cause problems with
|
||||
temp. nodes with init code used by CSE, see e.g. #38129
|
||||
}
|
||||
if not(right.expectloc in [LOC_FLAGS,LOC_JUMP]) and
|
||||
(node_complexity(right)>node_complexity(left)) then
|
||||
(node_complexity(right)>node_complexity(left)) and not(has_conditional_nodes(right)) then
|
||||
begin
|
||||
secondpass(right);
|
||||
if codegenerror then
|
||||
|
21
tests/webtbs/tw38129.pp
Normal file
21
tests/webtbs/tw38129.pp
Normal file
@ -0,0 +1,21 @@
|
||||
{ %opt=-O3 }
|
||||
{$mode objfpc}
|
||||
{$H+}
|
||||
function Bar(const progress: single; divs: uint32): string;
|
||||
const
|
||||
BarSym: array[boolean] of char = ('.', '#');
|
||||
var
|
||||
i: int32;
|
||||
begin
|
||||
SetLength(result, divs);
|
||||
for i := 0 to int32(divs) - 1 do
|
||||
pChar(result)[i] := BarSym[(progress >= (0.75 + i) / divs) or (i = int32(divs) - 1) and (progress >= 1)];
|
||||
end;
|
||||
|
||||
var
|
||||
s: string;
|
||||
|
||||
begin
|
||||
if Bar(0.7, 10)<>'#######...' then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user