Ver código fonte

* setelement nodes itself should not be considered, since setelement
nodes generate no code except loading data into registers, this does
not hurt, resolves #23342

git-svn-id: trunk@23039 -

florian 12 anos atrás
pai
commit
4aca018f62
3 arquivos alterados com 24 adições e 2 exclusões
  1. 1 0
      .gitattributes
  2. 6 2
      compiler/optcse.pas
  3. 17 0
      tests/webtbs/tw23342.pp

+ 1 - 0
.gitattributes

@@ -13004,6 +13004,7 @@ tests/webtbs/tw2323.pp svneol=native#text/plain
 tests/webtbs/tw23270.pp svneol=native#text/pascal
 tests/webtbs/tw2328.pp svneol=native#text/plain
 tests/webtbs/tw2332.pp svneol=native#text/plain
+tests/webtbs/tw23342.pp svneol=native#text/pascal
 tests/webtbs/tw2351.pp svneol=native#text/plain
 tests/webtbs/tw2363.pp svneol=native#text/plain
 tests/webtbs/tw2377.pp svneol=native#text/plain

+ 6 - 2
compiler/optcse.pas

@@ -158,8 +158,12 @@ unit optcse;
             { same for voiddef }
             not(is_void(n.resultdef)) and
             { adding tempref and callpara nodes itself is worthless but
-              their complexity is probably <= 1 anyways }
-            not(n.nodetype in [temprefn,callparan]) and
+              their complexity is probably <= 1 anyways
+
+              neither add setelementn nodes because the compiler sometimes depends on the fact
+              that a certain node stays a setelementn, this does not hurt either because
+              setelementn nodes itself generate no real code (except moving data into register) }
+            not(n.nodetype in [temprefn,callparan,setelementn]) and
 
             { node worth to add?
 

+ 17 - 0
tests/webtbs/tw23342.pp

@@ -0,0 +1,17 @@
+uses
+  classes;
+
+procedure foo(Shift: TShiftState);
+var
+  ssMultiSelect: TShiftStateEnum;
+  ATest: Boolean;
+begin
+  ssMultiSelect := ssCtrl;
+  // ATest := (Shift = [ssLeft, ssMultiSelect]); // compiles
+  // ATest := ATest or (Shift = [ssMultiSelect]); // compiles
+  ATest := (Shift = [ssLeft, ssMultiSelect]) or (Shift = [ssMultiSelect]); // fatal internal error 200203302 with -O2 or -O3
+end;
+
+begin
+end.
+