瀏覽代碼

+ write proper rtti for large sets, resolves #12788

git-svn-id: trunk@12371 -
florian 16 年之前
父節點
當前提交
e213be26fd
共有 4 個文件被更改,包括 44 次插入6 次删除
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/ncgrtti.pas
  3. 8 6
      compiler/symconst.pas
  4. 33 0
      tests/webtbs/tw12788.pp

+ 1 - 0
.gitattributes

@@ -8654,6 +8654,7 @@ tests/webtbs/tw12614.pp svneol=native#text/plain
 tests/webtbs/tw12685.pp svneol=native#text/plain
 tests/webtbs/tw1269.pp svneol=native#text/plain
 tests/webtbs/tw1275.pp svneol=native#text/plain
+tests/webtbs/tw12788.pp svneol=native#text/plain
 tests/webtbs/tw1279.pp svneol=native#text/plain
 tests/webtbs/tw1283.pp svneol=native#text/plain
 tests/webtbs/tw1284.pp svneol=native#text/plain

+ 2 - 0
compiler/ncgrtti.pas

@@ -535,6 +535,8 @@ implementation
                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otUWord));
              4:
                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otULong));
+             else
+               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otUByte));
            end;
            if (tf_requires_proper_alignment in target_info.flags) then
              current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt)));

+ 8 - 6
compiler/symconst.pas

@@ -64,12 +64,14 @@ const
   tkUString  = 24;
   tkUChar    = 25;
 
-  otSByte    = 0;
-  otUByte    = 1;
-  otSWord    = 2;
-  otUWord    = 3;
-  otSLong    = 4;
-  otULong    = 5;
+  otSByte     = 0;
+  otUByte     = 1;
+  otSWord     = 2;
+  otUWord     = 3;
+  otSLong     = 4;
+  otULong     = 5;
+  otSLongLong = 6;
+  otULongLong = 7;
 
   ftSingle   = 0;
   ftDouble   = 1;

+ 33 - 0
tests/webtbs/tw12788.pp

@@ -0,0 +1,33 @@
+{$packset 1}
+program t;
+{$mode objfpc}{$h+}
+
+uses typinfo;
+
+type
+  tsmall = 0..11;
+  tsmallset = set of tsmall;
+
+  tbig = 25..200;
+  tbigset_ = set of tbig;
+
+var
+  ti: PTypeInfo;
+  tdata: PTypeData;
+begin
+  ti := typeinfo(tsmallset);
+  tdata := GetTypeData(ti);
+  writeln(ord(tdata^.OrdType));
+  if tdata^.CompType = typeinfo(tsmall) then
+    writeln('small ok')
+  else
+    halt(1);
+
+  ti := typeinfo(tbigset_);
+  tdata := GetTypeData(ti);
+  writeln(ord(tdata^.OrdType));
+  if tdata^.CompType = typeinfo(tbig) then
+    writeln('big ok')
+  else
+    halt(2);
+end.