Procházet zdrojové kódy

* fixed another IE with indexing bitpacked arrays of composite types,
this time with constant rather than variable indices

git-svn-id: trunk@7599 -

Jonas Maebe před 18 roky
rodič
revize
de75b34dba
3 změnil soubory, kde provedl 19 přidání a 1 odebrání
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/ncgmem.pas
  3. 15 0
      tests/test/tparray21.pp

+ 1 - 0
.gitattributes

@@ -6908,6 +6908,7 @@ tests/test/tparray18.pp svneol=native#text/plain
 tests/test/tparray19.pp svneol=native#text/plain
 tests/test/tparray2.pp svneol=native#text/plain
 tests/test/tparray20.pp svneol=native#text/plain
+tests/test/tparray21.pp svneol=native#text/plain
 tests/test/tparray3.pp svneol=native#text/plain
 tests/test/tparray4.pp svneol=native#text/plain
 tests/test/tparray5.pp svneol=native#text/plain

+ 3 - 1
compiler/ncgmem.pas

@@ -781,7 +781,9 @@ implementation
               end;
               if not(is_packed_array(left.resultdef)) or
                  ((mulsize mod 8 = 0) and
-                  ispowerof2(mulsize div 8,temp)) then
+                  (ispowerof2(mulsize div 8,temp) or
+                   { only orddefs are bitpacked }
+                   not is_ordinal(resultdef))) then
                 begin
                   inc(location.reference.offset,
                     bytemulsize*tordconstnode(right).value);

+ 15 - 0
tests/test/tparray21.pp

@@ -0,0 +1,15 @@
+{$mode macpas}
+
+program FatalError_200301231;
+   type
+     note_name_type = packed array[0..17] of string[2];
+   var
+     nn: note_name_type;
+     s: string[ 80];
+begin
+   nn[1]:= 'x';
+   s:=concat( 'y', nn[ 1]);
+   if (s <> 'yx') then
+     halt(1);
+end.
+