Selaa lähdekoodia

Merged revisions 2608-2609 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r2608 | jonas | 2006-02-16 16:59:15 +0100 (Thu, 16 Feb 2006) | 5 lines

* also perform range checking in case fromdef falls inside todef, in
order to catch invalid operations due to uninitialised values,
not type-checked assignments (via explicit typecasts or e.g.
blockread), ...

........
r2609 | jonas | 2006-02-16 17:03:33 +0100 (Thu, 16 Feb 2006) | 2 lines

+ added

........

git-svn-id: branches/fixes_2_0@2610 -

Jonas Maebe 19 vuotta sitten
vanhempi
commit
4bdc07ae62
3 muutettua tiedostoa jossa 18 lisäystä ja 7 poistoa
  1. 1 0
      .gitattributes
  2. 0 7
      compiler/cgobj.pas
  3. 17 0
      tests/webtbf/tw4809.pp

+ 1 - 0
.gitattributes

@@ -5706,6 +5706,7 @@ tests/webtbf/tw4777.pp svneol=native#text/plain
 tests/webtbf/tw4778a.pp svneol=native#text/plain
 tests/webtbf/tw4781a.pp svneol=native#text/plain
 tests/webtbf/tw4781b.pp svneol=native#text/plain
+tests/webtbf/tw4809.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain
 tests/webtbf/uw0840b.pp svneol=native#text/plain

+ 0 - 7
compiler/cgobj.pas

@@ -1688,13 +1688,6 @@ implementation
           exit;
 {$endif cpu64bit}
 
-        { if the from-range falls completely in the to-range, no check }
-        { is necessary. Don't do this conversion for the largest unsigned type }
-        if (todef<>fromdef) and
-           (from_signed or (hfrom>=0)) and
-           (lto<=lfrom) and (hto>=hfrom) then
-          exit;
-
         { generate the rangecheck code for the def where we are going to }
         { store the result                                               }
 

+ 17 - 0
tests/webtbf/tw4809.pp

@@ -0,0 +1,17 @@
+{ %fail }
+
+{$r+}
+Type
+  MySet = (msOne,msTwo,msThree,msFour,msFive);
+
+  Var
+    aVar1: array[msOne..msFive] of LongInt = (1,2,3,4,5);
+    aVar2: array[msTwo..msFive] of LongInt = (2,3,4,5);
+    mVar: MySet;
+    v1,v2: LongInt;
+
+   begin
+     longint(mVar) := 100;
+     v1 := aVar1[mVar];
+  end.
+