Pārlūkot izejas kodu

* fixed wrong internal error in case a swapped set <op> setelement
addnode was processed after r10432/10433 (mantis #11255)

git-svn-id: trunk@10904 -

Jonas Maebe 17 gadi atpakaļ
vecāks
revīzija
0645313da5
3 mainītis faili ar 33 papildinājumiem un 4 dzēšanām
  1. 1 0
      .gitattributes
  2. 9 4
      compiler/ppcgen/ngppcadd.pas
  3. 23 0
      tests/webtbs/tw11255.pp

+ 1 - 0
.gitattributes

@@ -8185,6 +8185,7 @@ tests/webtbs/tw1122.pp svneol=native#text/plain
 tests/webtbs/tw1123.pp svneol=native#text/plain
 tests/webtbs/tw1124.pp svneol=native#text/plain
 tests/webtbs/tw11254.pp svneol=native#text/plain
+tests/webtbs/tw11255.pp svneol=native#text/plain
 tests/webtbs/tw1132.pp svneol=native#text/plain
 tests/webtbs/tw1133.pp svneol=native#text/plain
 tests/webtbs/tw1152.pp svneol=native#text/plain

+ 9 - 4
compiler/ppcgen/ngppcadd.pas

@@ -383,10 +383,15 @@ implementation
         pass_left_and_right;
 
         { when a setdef is passed, it has to be a smallset }
-        if not is_smallset(left.resultdef) or
-           (not is_smallset(right.resultdef) and
-            (right.nodetype<>setelementn)) then
-         internalerror(200203301);
+        if (not(nf_swapped in flags) and
+            not is_smallset(left.resultdef) or
+            (not is_smallset(right.resultdef) and
+             (right.nodetype<>setelementn))) or
+           ((nf_swapped in flags) and
+            not is_smallset(right.resultdef) or
+            (not is_smallset(left.resultdef) and
+             (left.nodetype<>setelementn))) then
+         internalerror(200203359);
 
         opdone := false;
         cmpop:=nodetype in [equaln,unequaln,lten,gten];

+ 23 - 0
tests/webtbs/tw11255.pp

@@ -0,0 +1,23 @@
+program bug11255;
+{$mode objfpc}{$h+}
+
+type
+  TLCLPlatform = (
+    lpCarbon
+    );
+    
+  TLCLPlatforms = set of TLCLPlatform;
+
+var
+  WidgetSets: TLCLPlatforms;    
+
+function DirNameToLCLPlatform: TLCLPlatform;
+begin
+  Result:=lpCarbon;
+end;
+
+begin
+  WidgetSets := [DirNameToLCLPlatform];
+  if widgetsets<>[lpcarbon] then
+    halt(1);
+end.