소스 검색

* handle case ranges properly for unsigned types with a non-zero base, resolves #10009

git-svn-id: trunk@8974 -
florian 18 년 전
부모
커밋
c3475dddc0
6개의 변경된 파일18개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/arm/narmset.pas
  3. 1 1
      compiler/i386/n386set.pas
  4. 1 1
      compiler/ncgset.pas
  5. 1 1
      compiler/ppcgen/ngppcset.pas
  6. 13 0
      tests/webtbs/tw10009.pp

+ 1 - 0
.gitattributes

@@ -7598,6 +7598,7 @@ tests/webtbs/tw0961.pp svneol=native#text/plain
 tests/webtbs/tw0965.pp svneol=native#text/plain
 tests/webtbs/tw0966.pp svneol=native#text/plain
 tests/webtbs/tw0976.pp svneol=native#text/plain
+tests/webtbs/tw10009.pp svneol=native#text/plain
 tests/webtbs/tw10013.pp svneol=native#text/plain
 tests/webtbs/tw1021.pp svneol=native#text/plain
 tests/webtbs/tw1023.pp svneol=native#text/plain

+ 1 - 1
compiler/arm/narmset.pas

@@ -153,7 +153,7 @@ implementation
                   if first then
                     begin
                        { have we to ajust the first value ? }
-                       if (t^._low>get_min_value(left.resultdef)) then
+                       if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then
                          begin
                            tcgarm(cg).cgsetflags:=true;
                            cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(int64(t^._low)), hregister);

+ 1 - 1
compiler/i386/n386set.pas

@@ -174,7 +174,7 @@ implementation
                   if first then
                     begin
                        { have we to ajust the first value ? }
-                       if (t^._low>get_min_value(left.resultdef)) then
+                       if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then
                          cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low.svalue), hregister);
                     end
                   else

+ 1 - 1
compiler/ncgset.pas

@@ -532,7 +532,7 @@ implementation
                 if first then
                   begin
                      { have we to ajust the first value ? }
-                     if (t^._low>get_min_value(left.resultdef)) then
+                     if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then
                        gensub(aint(t^._low.svalue));
                   end
                 else

+ 1 - 1
compiler/ppcgen/ngppcset.pas

@@ -199,7 +199,7 @@ implementation
                 if first then
                   begin
                      { have we to ajust the first value ? }
-                     if (t^._low>get_min_value(left.resultdef)) then
+                     if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then
                        gensub(longint(int64(t^._low)));
                   end
                 else

+ 13 - 0
tests/webtbs/tw10009.pp

@@ -0,0 +1,13 @@
+var
+  test : 2..14;
+
+begin
+  test:=14;
+  case test of
+    2..9: halt(1);
+    14: ;
+  else
+    halt(1);
+  end;
+  writeln('ok');
+end.