Explorar o código

* fixed web bug #4669 (usage of location.loc instead of expectloc)

git-svn-id: trunk@2236 -
Jonas Maebe %!s(int64=19) %!d(string=hai) anos
pai
achega
9f8753c6c0
Modificáronse 3 ficheiros con 23 adicións e 2 borrados
  1. 1 0
      .gitattributes
  2. 4 2
      compiler/ncgmem.pas
  3. 18 0
      tests/webtbs/tw4669.pp

+ 1 - 0
.gitattributes

@@ -6674,6 +6674,7 @@ tests/webtbs/tw4633.pp svneol=native#text/plain
 tests/webtbs/tw4634.pp -text
 tests/webtbs/tw4635.pp svneol=native#text/plain
 tests/webtbs/tw4640.pp svneol=native#text/plain
+tests/webtbs/tw4669.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 4 - 2
compiler/ncgmem.pas

@@ -672,7 +672,7 @@ implementation
               { calculate from left to right }
               if not(location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
                 internalerror(200304237);
-              isjump:=(right.location.loc=LOC_JUMP);
+              isjump:=(right.expectloc=LOC_JUMP);
               if isjump then
                begin
                  otl:=truelabel;
@@ -695,7 +695,9 @@ implementation
                begin
                  truelabel:=otl;
                  falselabel:=ofl;
-               end;
+               end
+              else if (right.location.loc = LOC_JUMP) then
+                internalerror(2006010801);
 
             { produce possible range check code: }
               if cs_check_range in aktlocalswitches then

+ 18 - 0
tests/webtbs/tw4669.pp

@@ -0,0 +1,18 @@
+{ Source provided for Free Pascal Bug Report 4669 }
+{ Submitted by "C.Stolk" on  2006-01-07 }
+{ e-mail: [email protected] }
+program test;
+
+const
+  nul1:array[boolean] of byte=(0,1);
+var
+  b,j,h:byte;
+begin
+b:=0;
+for j:=1 to 2 do
+  begin
+  h:=
+    nul1[(b=2) and (b=j)] or
+    nul1[(b=6)or(b=j)];
+  end;
+end.