Browse Source

- fix rtti generation for properties containing sl_vec
- fix crash when overloaded operator is not available
- fix record alignment for C style variant records

peter 21 years ago
parent
commit
1e3875ad36
5 changed files with 73 additions and 18 deletions
  1. 7 1
      compiler/fpcdefs.inc
  2. 10 2
      compiler/pdecvar.pas
  3. 7 2
      compiler/pexpr.pas
  4. 31 5
      compiler/symdef.pas
  5. 18 8
      compiler/symtable.pas

+ 7 - 1
compiler/fpcdefs.inc

@@ -60,6 +60,7 @@
   {$define cpu64bit}
   {$define cpuextended}
   {$define cpufloat128}
+  {$define noopt}
 {$endif x86_64}
 
 {$ifdef alpha}
@@ -94,7 +95,12 @@
 
 {
   $Log$
-  Revision 1.32  2004-02-09 22:48:45  florian
+  Revision 1.33  2004-02-17 15:57:49  peter
+  - fix rtti generation for properties containing sl_vec
+  - fix crash when overloaded operator is not available
+  - fix record alignment for C style variant records
+
+  Revision 1.32  2004/02/09 22:48:45  florian
     * several fixes to parameter handling on arm
 
   Revision 1.31  2004/01/28 16:47:45  peter

+ 10 - 2
compiler/pdecvar.pas

@@ -1115,7 +1115,10 @@ implementation
               UnionSym:=tvarsym.create('$case',vs_value,uniontype);
               symtablestack:=symtablestack.next;
               { Align the offset where the union symtable is added }
-              usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign);
+              if (trecordsymtable(symtablestack).usefieldalignment=-1) then
+                usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
+              else  
+                usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.recordalignmax);
               offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
               trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
               if maxalignment>trecordsymtable(symtablestack).fieldalignment then
@@ -1135,7 +1138,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.65  2004-02-12 15:54:03  peter
+  Revision 1.66  2004-02-17 15:57:49  peter
+  - fix rtti generation for properties containing sl_vec
+  - fix crash when overloaded operator is not available
+  - fix record alignment for C style variant records
+
+  Revision 1.65  2004/02/12 15:54:03  peter
     * make extcycle is working again
 
   Revision 1.64  2004/02/03 22:32:54  peter

+ 7 - 2
compiler/pexpr.pas

@@ -213,7 +213,7 @@ implementation
               end;
             vecn :
               begin
-                addnode(tsubscriptnode(p).left);
+                addnode(tvecnode(p).left);
                 if tvecnode(p).right.nodetype=ordconstn then
                   sl.addconst(sl_vec,tordconstnode(tvecnode(p).right).value)
                 else
@@ -2525,7 +2525,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.146  2004-02-03 22:32:54  peter
+  Revision 1.147  2004-02-17 15:57:49  peter
+  - fix rtti generation for properties containing sl_vec
+  - fix crash when overloaded operator is not available
+  - fix record alignment for C style variant records
+
+  Revision 1.146  2004/02/03 22:32:54  peter
     * renamed xNNbittype to xNNinttype
     * renamed registers32 to registersint
     * replace some s32bit,u32bit with torddef([su]inttype).def.typ

+ 31 - 5
compiler/symdef.pas

@@ -1043,8 +1043,8 @@ implementation
 
     function tstoreddef.alignment : longint;
       begin
-         { normal alignment by default }
-         alignment:=0;
+         { natural alignment by default }
+         alignment:=size_2_align(savesize);
       end;
 
 
@@ -5299,7 +5299,7 @@ implementation
            typvalue : byte;
            hp : psymlistitem;
            address : longint;
-
+           def : tdef;
         begin
            if not(assigned(proc) and assigned(proc.firstsym))  then
              begin
@@ -5310,9 +5310,30 @@ implementation
              begin
                 address:=0;
                 hp:=proc.firstsym;
+                def:=nil;
                 while assigned(hp) do
                   begin
-                     inc(address,tvarsym(hp^.sym).fieldoffset);
+                     case hp^.sltype of
+                       sl_load :
+                         begin
+                           def:=tvarsym(hp^.sym).vartype.def;
+                           inc(address,tvarsym(hp^.sym).fieldoffset);
+                         end;
+                       sl_subscript :
+                         begin
+                           if not(assigned(def) and (def.deftype=recorddef)) then
+                             internalerror(200402171);
+                           inc(address,tvarsym(hp^.sym).fieldoffset);
+                           def:=tvarsym(hp^.sym).vartype.def;
+                         end;  
+                       sl_vec :
+                         begin
+                           if not(assigned(def) and (def.deftype=arraydef)) then
+                             internalerror(200402172);
+                           def:=tarraydef(def).elementtype.def;
+                           inc(address,def.size*hp^.value);
+                         end;  
+                     end;      
                      hp:=hp^.next;
                   end;
                 rttiList.concat(Tai_const.Create_32bit(address));
@@ -6096,7 +6117,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.218  2004-02-12 15:54:03  peter
+  Revision 1.219  2004-02-17 15:57:49  peter
+  - fix rtti generation for properties containing sl_vec
+  - fix crash when overloaded operator is not available
+  - fix record alignment for C style variant records
+
+  Revision 1.218  2004/02/12 15:54:03  peter
     * make extcycle is working again
 
   Revision 1.217  2004/02/08 18:08:59  jonas

+ 18 - 8
compiler/symtable.pas

@@ -1088,7 +1088,10 @@ implementation
         tvarsym(sym).fieldoffset:=align(datasize,varalignfield);
         datasize:=tvarsym(sym).fieldoffset+l;
         { Calc alignment needed for this record }
-        varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.recordalignmax);
+        if (usefieldalignment=-1) then
+          varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
+        else  
+          varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.recordalignmax);
         recordalignment:=max(recordalignment,varalignrecord);
       end;
 
@@ -2082,6 +2085,7 @@ implementation
         sv:cardinal;
 
     begin
+      result:=nil;
       st:=symtablestack;
       sv:=getspeedvalue(overloaded_names[op]);
       while st<>nil do
@@ -2091,9 +2095,9 @@ implementation
             begin
               if sym.typ<>procsym then
                 internalerror(200402031);
-              search_unary_operator:=sym.search_procdef_unary_operator(def);
-              if search_unary_operator<>nil then
-                break;
+              result:=sym.search_procdef_unary_operator(def);
+              if result<>nil then
+                exit;
             end;
           st:=st.next;
         end;
@@ -2107,6 +2111,7 @@ implementation
         sv:cardinal;
 
     begin
+      result:=nil;
       st:=symtablestack;
       sv:=getspeedvalue(overloaded_names[op]);
       while st<>nil do
@@ -2116,9 +2121,9 @@ implementation
             begin
               if sym.typ<>procsym then
                 internalerror(200402031);
-              search_binary_operator:=sym.search_procdef_binary_operator(def1,def2);
-              if search_binary_operator<>nil then
-                break;
+              result:=sym.search_procdef_binary_operator(def1,def2);
+              if result<>nil then
+                exit;
             end;
           st:=st.next;
         end;
@@ -2422,7 +2427,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.137  2004-02-13 15:40:58  peter
+  Revision 1.138  2004-02-17 15:57:49  peter
+  - fix rtti generation for properties containing sl_vec
+  - fix crash when overloaded operator is not available
+  - fix record alignment for C style variant records
+
+  Revision 1.137  2004/02/13 15:40:58  peter
     * fixed protected checking in withsymtable
 
   Revision 1.136  2004/02/11 19:59:06  peter