瀏覽代碼

* is_range_test returns false if "lower" bound is greater than "upper" bound

git-svn-id: trunk@39837 -
florian 6 年之前
父節點
當前提交
352fb866ef
共有 3 個文件被更改,包括 16 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 3 0
      compiler/nadd.pas
  3. 12 0
      tests/tbs/tb0652.pp

+ 1 - 0
.gitattributes

@@ -11714,6 +11714,7 @@ tests/tbs/tb0648.pp svneol=native#text/pascal
 tests/tbs/tb0649.pp -text svneol=native#text/pascal
 tests/tbs/tb0650.pp svneol=native#text/pascal
 tests/tbs/tb0651.pp svneol=native#text/pascal
+tests/tbs/tb0652.pp svneol=native#text/pascal
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/tb610.pp svneol=native#text/pascal
 tests/tbs/tb613.pp svneol=native#text/plain

+ 3 - 0
compiler/nadd.pas

@@ -439,6 +439,9 @@ implementation
               cr:=t;
             end;
 
+          if cl>cr then
+            exit;
+
           result:=true;
         end;
 

+ 12 - 0
tests/tbs/tb0652.pp

@@ -0,0 +1,12 @@
+const
+  w : dword = 123;
+
+begin
+  if (w<=1) and (w>=10) then
+    halt(1);
+  if (w>=1) and (w<=1000) then
+    writeln('ok')
+  else
+    halt(1);
+end.
+