From de75b34dbac159e826ac3c56c533955d34a5943e Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 8 Jun 2007 13:53:01 +0000 Subject: [PATCH] * fixed another IE with indexing bitpacked arrays of composite types, this time with constant rather than variable indices git-svn-id: trunk@7599 - --- .gitattributes | 1 + compiler/ncgmem.pas | 4 +++- tests/test/tparray21.pp | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/test/tparray21.pp diff --git a/.gitattributes b/.gitattributes index ce8221fb0a..db6163b03f 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index e1aefb6a6c..54ed9ed64d 100644 --- a/compiler/ncgmem.pas +++ b/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); diff --git a/tests/test/tparray21.pp b/tests/test/tparray21.pp new file mode 100644 index 0000000000..520eda48f4 --- /dev/null +++ b/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. +