Browse Source

* fixed bitsize of qwords in bitpacked records (mantis #9054)

git-svn-id: trunk@7632 -
Jonas Maebe 18 years ago
parent
commit
af97f3350b
3 changed files with 38 additions and 6 deletions
  1. 1 0
      .gitattributes
  2. 6 6
      compiler/symdef.pas
  3. 31 0
      tests/webtbs/tw9054.pp

+ 1 - 0
.gitattributes

@@ -8291,6 +8291,7 @@ tests/webtbs/tw8919.pp svneol=native#text/plain
 tests/webtbs/tw8950.pp svneol=native#text/plain
 tests/webtbs/tw8975.pp svneol=native#text/plain
 tests/webtbs/tw8975a.pp svneol=native#text/plain
+tests/webtbs/tw9054.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 6 - 6
compiler/symdef.pas

@@ -1505,14 +1505,14 @@ implementation
         if ordtype = uvoid then
           exit;
 
-        if (low >= 0) and
+        if (ordtype = u64bit) or
+           ((ordtype = s64bit) and
+            ((low <= (system.low(int64) div 2)) or
+             (high > (system.high(int64) div 2)))) then
+          result := 64
+        else if (low >= 0) and
            (high <= 1) then
           result := 1
-        else if (ordtype = u64bit) or
-                ((ordtype = s64bit) and
-                 ((low <= (system.low(int64) div 2)) or
-                  (high > (system.high(int64) div 2)))) then
-          result := 64
         else
           begin
             if (low>=0) then

+ 31 - 0
tests/webtbs/tw9054.pp

@@ -0,0 +1,31 @@
+{$mode macpas}
+
+program FatalError_2006082312;
+
+type
+  UInt16 = Word;
+  UInt64 = QWord;
+
+  CoreMidiPacket = packed record
+    timeStamp: UInt64;
+    length: UInt16;
+    data: packed array [0..255] of byte
+  end;
+
+procedure test(var gCoreMidiPacket: CoreMidiPacket);
+begin
+  with gCoreMidiPacket do
+    begin
+      timeStamp := high(int64);
+      length := $2345;
+    end
+end;
+
+var
+  gcmp: CoreMidiPacket;
+begin
+  test(gcmp);
+  if (gcmp.timestamp <> high(int64)) or
+     (gcmp.length<>$2345) then
+    halt(1);
+end.