Browse Source

* several memory corruptions due to double freemem solved
=> never use p^.loc.location:=p^.left^.loc.location;
+ finally I added now by default
that ra386dir translates global and unit symbols
+ added a first field in tsymtable and
a nextsym field in tsym
(this allows to obtain ordered type info for
records and objects in gdb !)

pierre 27 years ago
parent
commit
1a77339355

+ 12 - 2
compiler/ag68kmpw.pas

@@ -547,7 +547,7 @@ ait_labeled_instruction :
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module^.mainsource) then
       if assigned(current_module^.mainsource) then
-       comment(v_info,'Start writing motorola-styled assembler output for '+current_module^.mainsource^);
+       comment(v_info,'Start writing MPW-styled assembler output for '+current_module^.mainsource^);
 {$endif}
 {$endif}
       WriteTree(externals);
       WriteTree(externals);
       AsmLn;
       AsmLn;
@@ -579,7 +579,17 @@ ait_labeled_instruction :
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  1998-10-14 15:56:42  pierre
+  Revision 1.5  1998-10-20 08:06:37  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.4  1998/10/14 15:56:42  pierre
     * all references to comp suppressed for m68k
     * all references to comp suppressed for m68k
 
 
   Revision 1.3  1998/10/12 12:20:47  pierre
   Revision 1.3  1998/10/12 12:20:47  pierre

+ 15 - 2
compiler/cg386add.pas

@@ -507,7 +507,10 @@ implementation
                        if p^.left^.treetype=ordconstn then
                        if p^.left^.treetype=ordconstn then
                         swaptree(p);
                         swaptree(p);
                        secondpass(p^.left);
                        secondpass(p^.left);
-                       p^.location:=p^.left^.location;
+                       set_location(p^.location,p^.left^.location);
+                       {p^.location:=p^.left^.location;
+                       created a bug !!! PM
+                       because symbol was used twice }
                        { are enough registers free ? }
                        { are enough registers free ? }
                        pushed:=maybe_push(p^.right^.registers32,p);
                        pushed:=maybe_push(p^.right^.registers32,p);
                        secondpass(p^.right);
                        secondpass(p^.right);
@@ -1290,7 +1293,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  1998-10-09 11:47:45  pierre
+  Revision 1.18  1998-10-20 08:06:38  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.17  1998/10/09 11:47:45  pierre
     * still more memory leaks fixes !!
     * still more memory leaks fixes !!
 
 
   Revision 1.16  1998/10/09 08:56:21  pierre
   Revision 1.16  1998/10/09 08:56:21  pierre

+ 13 - 1
compiler/cg386cal.pas

@@ -1163,6 +1163,8 @@ implementation
                 emitcall(p^.procdefinition^.mangledname,
                 emitcall(p^.procdefinition^.mangledname,
                   (p^.symtableproc^.symtabletype=unitsymtable) or
                   (p^.symtableproc^.symtabletype=unitsymtable) or
                   ((p^.symtableproc^.symtabletype=objectsymtable) and
                   ((p^.symtableproc^.symtabletype=objectsymtable) and
+                  (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable))or
+                  ((p^.symtableproc^.symtabletype=withsymtable) and
                   (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable)))
                   (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable)))
               else { inlined proc }
               else { inlined proc }
                 { inlined code is in inlinecode }
                 { inlined code is in inlinecode }
@@ -1512,7 +1514,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  1998-10-16 08:51:45  peter
+  Revision 1.36  1998-10-20 08:06:39  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.35  1998/10/16 08:51:45  peter
     + target_os.stackalignment
     + target_os.stackalignment
     + stack can be aligned at 2 or 4 byte boundaries
     + stack can be aligned at 2 or 4 byte boundaries
 
 

+ 25 - 1
compiler/cg386inl.pas

@@ -814,12 +814,25 @@ implementation
                  end
                  end
                 else
                 else
                  begin
                  begin
+                    { BUG HERE : detected with nasm :
+                      hregister is allways 32 bit
+                      it should be converted to 16 or 8 bit depending on op_size  PM }
+                    { still not perfect :
+                      if hregister is already a 16 bit reg ?? PM }
+                    case opsize of
+                      S_B : hregister:=reg32toreg8(hregister);
+                      S_W : hregister:=reg32toreg16(hregister);
+                    end;
                     if p^.left^.left^.location.loc=LOC_CREGISTER then
                     if p^.left^.left^.location.loc=LOC_CREGISTER then
                       exprasmlist^.concat(new(pai386,op_reg_reg(addsubop[p^.inlinenumber],opsize,
                       exprasmlist^.concat(new(pai386,op_reg_reg(addsubop[p^.inlinenumber],opsize,
                         hregister,p^.left^.left^.location.register)))
                         hregister,p^.left^.left^.location.register)))
                     else
                     else
                       exprasmlist^.concat(new(pai386,op_reg_ref(addsubop[p^.inlinenumber],opsize,
                       exprasmlist^.concat(new(pai386,op_reg_ref(addsubop[p^.inlinenumber],opsize,
                         hregister,newreference(p^.left^.left^.location.reference))));
                         hregister,newreference(p^.left^.left^.location.reference))));
+                    case opsize of
+                      S_B : hregister:=reg8toreg32(hregister);
+                      S_W : hregister:=reg16toreg32(hregister);
+                    end;
                    ungetregister32(hregister);
                    ungetregister32(hregister);
                  end;
                  end;
                 emitoverflowcheck(p^.left^.left);
                 emitoverflowcheck(p^.left^.left);
@@ -929,6 +942,7 @@ implementation
                         end
                         end
                       else
                       else
                         begin
                         begin
+                           internalerror(10083);
                         end;
                         end;
                    end;
                    end;
               end;
               end;
@@ -941,7 +955,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  1998-10-13 16:50:02  pierre
+  Revision 1.14  1998-10-20 08:06:40  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.13  1998/10/13 16:50:02  pierre
     * undid some changes of Peter that made the compiler wrong
     * undid some changes of Peter that made the compiler wrong
       for m68k (I had to reinsert some ifdefs)
       for m68k (I had to reinsert some ifdefs)
     * removed several memory leaks under m68k
     * removed several memory leaks under m68k

+ 13 - 3
compiler/cg386mat.pas

@@ -348,7 +348,7 @@ implementation
 {$ifdef SUPPORT_MMX}
 {$ifdef SUPPORT_MMX}
             LOC_MMXREGISTER:
             LOC_MMXREGISTER:
               begin
               begin
-                 p^.location:=p^.left^.location;
+                 set_location(p^.location,p^.left^.location);
                  emit_reg_reg(A_PXOR,S_NO,R_MM7,R_MM7);
                  emit_reg_reg(A_PXOR,S_NO,R_MM7,R_MM7);
                  do_mmx_neg;
                  do_mmx_neg;
               end;
               end;
@@ -488,7 +488,7 @@ implementation
                  { load operand }
                  { load operand }
                  case p^.left^.location.loc of
                  case p^.left^.location.loc of
                     LOC_MMXREGISTER:
                     LOC_MMXREGISTER:
-                      p^.location:=p^.left^.location;
+                      set_location(p^.location,p^.left^.location);
                     LOC_CMMXREGISTER:
                     LOC_CMMXREGISTER:
                       begin
                       begin
                          p^.location.register:=getregistermmx;
                          p^.location.register:=getregistermmx;
@@ -561,7 +561,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  1998-10-09 08:56:24  pierre
+  Revision 1.9  1998-10-20 08:06:42  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.8  1998/10/09 08:56:24  pierre
     * several memory leaks fixed
     * several memory leaks fixed
 
 
   Revision 1.7  1998/09/17 09:42:17  peter
   Revision 1.7  1998/09/17 09:42:17  peter

+ 12 - 2
compiler/cg68kadd.pas

@@ -580,7 +580,7 @@ implementation
                        if p^.left^.treetype=ordconstn then
                        if p^.left^.treetype=ordconstn then
                         swaptree(p);
                         swaptree(p);
                        secondpass(p^.left);
                        secondpass(p^.left);
-                       p^.location:=p^.left^.location;
+                       set_location(p^.location,p^.left^.location);
                        { are enough registers free ? }
                        { are enough registers free ? }
                        pushed:=maybe_push(p^.right^.registers32,p);
                        pushed:=maybe_push(p^.right^.registers32,p);
                        secondpass(p^.right);
                        secondpass(p^.right);
@@ -1279,7 +1279,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1998-10-17 02:53:48  carl
+  Revision 1.13  1998-10-20 08:06:43  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.12  1998/10/17 02:53:48  carl
     * bugfix of FPU deallocation in $E- mode
     * bugfix of FPU deallocation in $E- mode
 
 
   Revision 1.11  1998/10/14 11:28:15  florian
   Revision 1.11  1998/10/14 11:28:15  florian

+ 16 - 2
compiler/cg68kcal.pas

@@ -841,7 +841,11 @@ implementation
                 end
                 end
               else
               else
                 emitcall(p^.procdefinition^.mangledname,
                 emitcall(p^.procdefinition^.mangledname,
-                  p^.symtableproc^.symtabletype=unitsymtable);
+                  (p^.symtableproc^.symtabletype=unitsymtable) or
+                  ((p^.symtableproc^.symtabletype=objectsymtable) and
+                  (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable))or
+                  ((p^.symtableproc^.symtabletype=withsymtable) and
+                  (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable)));
               if ((p^.procdefinition^.options and poclearstack)<>0) then
               if ((p^.procdefinition^.options and poclearstack)<>0) then
                 begin
                 begin
                    if (pushedparasize > 0) and (pushedparasize < 9) then
                    if (pushedparasize > 0) and (pushedparasize < 9) then
@@ -1052,7 +1056,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1998-10-19 08:54:53  pierre
+  Revision 1.13  1998-10-20 08:06:45  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.12  1998/10/19 08:54:53  pierre
     * wrong stabs info corrected once again !!
     * wrong stabs info corrected once again !!
     + variable vmt offset with vmt field only if required
     + variable vmt offset with vmt field only if required
       implemented now !!!
       implemented now !!!

+ 13 - 3
compiler/cga68k.pas

@@ -1327,14 +1327,14 @@ end;
              if (dest_loc.loc=LOC_CREGISTER) or (dest_loc.loc=LOC_REGISTER) then
              if (dest_loc.loc=LOC_CREGISTER) or (dest_loc.loc=LOC_REGISTER) then
                begin
                begin
                  emit_reg_reg(A_MOVE,s,reg,dest_loc.register);
                  emit_reg_reg(A_MOVE,s,reg,dest_loc.register);
-                 p^.location:=dest_loc;
+                 set_location(p^.location,dest_loc);
                  in_dest_loc:=true;
                  in_dest_loc:=true;
                end
                end
              else
              else
              if (dest_loc.loc=LOC_REFERENCE) or (dest_loc.loc=LOC_MEM) then
              if (dest_loc.loc=LOC_REFERENCE) or (dest_loc.loc=LOC_MEM) then
                begin
                begin
                  exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,s,reg,newreference(dest_loc.reference))));
                  exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,s,reg,newreference(dest_loc.reference))));
-                 p^.location:=dest_loc;
+                 set_location(p^.location,dest_loc);
                  in_dest_loc:=true;
                  in_dest_loc:=true;
                end
                end
              else
              else
@@ -1346,7 +1346,17 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  1998-10-16 13:12:48  pierre
+  Revision 1.26  1998-10-20 08:06:46  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.25  1998/10/16 13:12:48  pierre
     * added vmt_offsets in destructors code also !!!
     * added vmt_offsets in destructors code also !!!
     * vmt_offset code for m68k
     * vmt_offset code for m68k
 
 

+ 1 - 1
compiler/msgtxt.inc

@@ -385,7 +385,7 @@ const msgtxt : array[0..00091,1..240] of char=(+
   'W_NEAR ignored'#000+
   'W_NEAR ignored'#000+
   'W_FAR ignored'#000+
   'W_FAR ignored'#000+
   'D_Creating inline asm lookup tables'#000+
   'D_Creating inline asm lookup tables'#000+
-  'W_Using a defined name as a local ','label'#000+
+  'E_Using a defined name as a local ','label'#000+
   'F_internal error in HandleExtend()'#000+
   'F_internal error in HandleExtend()'#000+
   'E_Invalid character: <'#000+
   'E_Invalid character: <'#000+
   'E_Invalid character: >'#000+
   'E_Invalid character: >'#000+

+ 14 - 3
compiler/pstatmnt.pas

@@ -377,6 +377,7 @@ unit pstatmnt;
                               symtab^.next:=new(psymtable,init(symtable.withsymtable));
                               symtab^.next:=new(psymtable,init(symtable.withsymtable));
                               symtab:=symtab^.next;
                               symtab:=symtab^.next;
                               symtab^.root:=obj^.publicsyms^.root;
                               symtab^.root:=obj^.publicsyms^.root;
+                              symtab^.defowner:=obj;
                               obj:=obj^.childof;
                               obj:=obj^.childof;
                               inc(levelcount);
                               inc(levelcount);
                             end;
                             end;
@@ -1203,8 +1204,8 @@ unit pstatmnt;
                   procinfo.framepointer:=R_SP;
                   procinfo.framepointer:=R_SP;
 {$endif}
 {$endif}
                   { set the right value for parameters }
                   { set the right value for parameters }
-                  dec(aktprocsym^.definition^.parast^.call_offset,sizeof(pointer));
-                  dec(procinfo.call_offset,sizeof(pointer));
+                  dec(aktprocsym^.definition^.parast^.call_offset,target_os.size_of_pointer);
+                  dec(procinfo.call_offset,target_os.size_of_pointer);
               end;
               end;
             assembler_block:=_asm_statement;
             assembler_block:=_asm_statement;
           { becuase the END is already read we need to get the
           { becuase the END is already read we need to get the
@@ -1215,7 +1216,17 @@ unit pstatmnt;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.45  1998-10-19 08:55:01  pierre
+  Revision 1.46  1998-10-20 08:06:53  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.45  1998/10/19 08:55:01  pierre
     * wrong stabs info corrected once again !!
     * wrong stabs info corrected once again !!
     + variable vmt offset with vmt field only if required
     + variable vmt offset with vmt field only if required
       implemented now !!!
       implemented now !!!

+ 20 - 2
compiler/ptconst.pas

@@ -54,7 +54,7 @@ unit ptconst;
 {$ifdef m68k}
 {$ifdef m68k}
          j : longint;
          j : longint;
 {$endif m68k}
 {$endif m68k}
-         p         : ptree;
+         p,hp      : ptree;
          i,l,offset,
          i,l,offset,
          strlength : longint;
          strlength : longint;
          lsym      : pvarsym;
          lsym      : pvarsym;
@@ -166,6 +166,14 @@ unit ptconst;
            begin
            begin
               p:=comp_expr(true);
               p:=comp_expr(true);
               do_firstpass(p);
               do_firstpass(p);
+              { allows horrible ofs(typeof(TButton)^) code !! }
+              if (p^.treetype=addrn) and (p^.left^.treetype=derefn) then
+                begin
+                   hp:=p^.left^.left;
+                   p^.left^.left:=nil;
+                   disposetree(p);
+                   p:=hp;
+                end;
               { nil pointer ? }
               { nil pointer ? }
               if p^.treetype=niln then
               if p^.treetype=niln then
                 datasegment^.concat(new(pai_const,init_32bit(0)))
                 datasegment^.concat(new(pai_const,init_32bit(0)))
@@ -612,7 +620,17 @@ unit ptconst;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  1998-10-19 08:55:03  pierre
+  Revision 1.22  1998-10-20 08:06:56  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.21  1998/10/19 08:55:03  pierre
     * wrong stabs info corrected once again !!
     * wrong stabs info corrected once again !!
     + variable vmt offset with vmt field only if required
     + variable vmt offset with vmt field only if required
       implemented now !!!
       implemented now !!!

+ 12 - 2
compiler/ra386dir.pas

@@ -180,7 +180,7 @@ unit Ra386dir;
                                       else
                                       else
 
 
                                         begin
                                         begin
-{$ifdef TESTGLOBALVAR}
+{$ifndef IGNOREGLOBALVAR}
                                            getsym(upper(hs),false);
                                            getsym(upper(hs),false);
                                            sym:=srsym;
                                            sym:=srsym;
                                            if assigned(sym) and (sym^.owner^.symtabletype in [unitsymtable,
                                            if assigned(sym) and (sym^.owner^.symtabletype in [unitsymtable,
@@ -262,7 +262,17 @@ unit Ra386dir;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.8  1998-09-04 08:42:08  peter
+  Revision 1.9  1998-10-20 08:06:57  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.8  1998/09/04 08:42:08  peter
     * updated some error messages
     * updated some error messages
 
 
   Revision 1.7  1998/09/03 17:39:05  florian
   Revision 1.7  1998/09/03 17:39:05  florian

+ 79 - 29
compiler/symdef.inc

@@ -423,7 +423,7 @@
          string_typ:=st_longstring;
          string_typ:=st_longstring;
          deftype:=stringdef;
          deftype:=stringdef;
          len:=l;
          len:=l;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -433,7 +433,7 @@
          deftype:=stringdef;
          deftype:=stringdef;
          string_typ:=st_longstring;
          string_typ:=st_longstring;
          len:=readlong;
          len:=readlong;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -443,7 +443,7 @@
          string_typ:=st_ansistring;
          string_typ:=st_ansistring;
          deftype:=stringdef;
          deftype:=stringdef;
          len:=l;
          len:=l;
-         savesize:=sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -453,7 +453,7 @@
          deftype:=stringdef;
          deftype:=stringdef;
          string_typ:=st_ansistring;
          string_typ:=st_ansistring;
          len:=readlong;
          len:=readlong;
-         savesize:=sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -463,7 +463,7 @@
          string_typ:=st_widestring;
          string_typ:=st_widestring;
          deftype:=stringdef;
          deftype:=stringdef;
          len:=l;
          len:=l;
-         savesize:=sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -473,7 +473,7 @@
          deftype:=stringdef;
          deftype:=stringdef;
          string_typ:=st_widestring;
          string_typ:=st_widestring;
          len:=readlong;
          len:=readlong;
-         savesize:=sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1166,7 +1166,7 @@
          inherited init;
          inherited init;
          deftype:=pointerdef;
          deftype:=pointerdef;
          definition:=def;
          definition:=def;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1176,7 +1176,7 @@
          deftype:=pointerdef;
          deftype:=pointerdef;
          { the real address in memory is calculated later (deref) }
          { the real address in memory is calculated later (deref) }
          definition:=readdefref;
          definition:=readdefref;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1254,7 +1254,7 @@
          inherited init(def);
          inherited init(def);
          deftype:=classrefdef;
          deftype:=classrefdef;
          definition:=def;
          definition:=def;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1409,7 +1409,7 @@
       begin
       begin
          inherited init;
          inherited init;
          deftype:=formaldef;
          deftype:=formaldef;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1417,7 +1417,7 @@
       begin
       begin
          inherited load;
          inherited load;
          deftype:=formaldef;
          deftype:=formaldef;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1690,13 +1690,21 @@
     procedure addname(p : psym);
     procedure addname(p : psym);
     var
     var
       news, newrec : pchar;
       news, newrec : pchar;
+      spec : string[2];
     begin
     begin
     { static variables from objects are like global objects }
     { static variables from objects are like global objects }
     if ((p^.properties and sp_static)<>0) then
     if ((p^.properties and sp_static)<>0) then
       exit;
       exit;
+    if ((p^.properties and sp_protected)<>0) then
+      spec:='/1'
+    else if ((p^.properties and sp_private)<>0) then
+      spec:='/0'
+    else
+      spec:='';
+
     If p^.typ = varsym then
     If p^.typ = varsym then
        begin
        begin
-       newrec := strpnew(p^.name+':'+pvarsym(p)^.definition^.numberstring
+       newrec := strpnew(p^.name+':'+spec+pvarsym(p)^.definition^.numberstring
                      +','+tostr(pvarsym(p)^.address*8)+','
                      +','+tostr(pvarsym(p)^.address*8)+','
                      +tostr(pvarsym(p)^.definition^.size*8)+';');
                      +tostr(pvarsym(p)^.definition^.size*8)+';');
        if strlen(StabRecString) + strlen(newrec) >= StabRecSize-256 then
        if strlen(StabRecString) + strlen(newrec) >= StabRecSize-256 then
@@ -1718,6 +1726,7 @@
     function trecdef.stabstring : pchar;
     function trecdef.stabstring : pchar;
       Var oldrec : pchar;
       Var oldrec : pchar;
           oldsize : longint;
           oldsize : longint;
+          cur : psym;
       begin
       begin
         oldrec := stabrecstring;
         oldrec := stabrecstring;
         oldsize:=stabrecsize;
         oldsize:=stabrecsize;
@@ -1725,11 +1734,20 @@
         stabrecsize:=memsizeinc;
         stabrecsize:=memsizeinc;
         strpcopy(stabRecString,'s'+tostr(savesize));
         strpcopy(stabRecString,'s'+tostr(savesize));
         RecOffset := 0;
         RecOffset := 0;
+{$ifdef nonextfield}
         {$ifdef tp}
         {$ifdef tp}
           symtable^.foreach(addname);
           symtable^.foreach(addname);
         {$else}
         {$else}
           symtable^.foreach(@addname);
           symtable^.foreach(@addname);
         {$endif}
         {$endif}
+{$else nonextfield}
+         cur:=symtable^.root;
+         while assigned(cur) do
+           begin
+              addname(cur);
+              cur:=cur^.nextsym;
+           end;
+{$endif nonextfield}
         { FPC doesn't want to convert a char to a pchar}
         { FPC doesn't want to convert a char to a pchar}
         { is this a bug ? }
         { is this a bug ? }
         strpcopy(strend(StabRecString),';');
         strpcopy(strend(StabRecString),';');
@@ -1843,7 +1861,7 @@
          fpu_used:=0;
          fpu_used:=0;
          options:=0;
          options:=0;
          retdef:=voiddef;
          retdef:=voiddef;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -1915,7 +1933,7 @@
          options:=readlong;
          options:=readlong;
          count:=readword;
          count:=readword;
          para1:=nil;
          para1:=nil;
-         savesize:=Sizeof(pointer);
+         savesize:=target_os.size_of_pointer;
          for i:=1 to count do
          for i:=1 to count do
            begin
            begin
               new(hp);
               new(hp);
@@ -1942,9 +1960,9 @@
           begin
           begin
             case pdc^.paratyp of
             case pdc^.paratyp of
               vs_value : inc(l,align(pdc^.data^.size,target_os.stackalignment));
               vs_value : inc(l,align(pdc^.data^.size,target_os.stackalignment));
-              vs_var   : inc(l,sizeof(pointer));
+              vs_var   : inc(l,target_os.size_of_pointer);
               vs_const : if dont_copy_const_param(pdc^.data) then
               vs_const : if dont_copy_const_param(pdc^.data) then
-                          inc(l,sizeof(pointer))
+                          inc(l,target_os.size_of_pointer)
                          else
                          else
                           inc(l,align(pdc^.data^.size,target_os.stackalignment));
                           inc(l,align(pdc^.data^.size,target_os.stackalignment));
             end;
             end;
@@ -2298,6 +2316,7 @@
       if i>0 then
       if i>0 then
         begin
         begin
         strpcopy(strend(StabRecString),','+tostr(i)+';');
         strpcopy(strend(StabRecString),','+tostr(i)+';');
+        (* confuse gdb !! PM
         if assigned(parast) then
         if assigned(parast) then
           {$IfDef TP}
           {$IfDef TP}
           parast^.foreach(addparaname)
           parast^.foreach(addparaname)
@@ -2318,7 +2337,7 @@
                +':'+param^.data^.numberstring+','+vartyp+';');
                +':'+param^.data^.numberstring+','+vartyp+';');
             param := param^.next;
             param := param^.next;
             end;
             end;
-          end;
+          end;   *)
         {strpcopy(strend(StabRecString),';');}
         {strpcopy(strend(StabRecString),';');}
         end;
         end;
       stabstring := strnew(stabrecstring);
       stabstring := strnew(stabrecstring);
@@ -2444,9 +2463,9 @@
     function tprocvardef.size : longint;
     function tprocvardef.size : longint;
       begin
       begin
          if (options and pomethodpointer)=0 then
          if (options and pomethodpointer)=0 then
-           size:=sizeof(pointer)
+           size:=target_os.size_of_pointer
          else
          else
-           size:=2*sizeof(pointer);
+           size:=2*target_os.size_of_pointer;
       end;
       end;
 
 
 
 
@@ -2540,7 +2559,7 @@
         publicsyms^.name := stringdup(n);
         publicsyms^.name := stringdup(n);
         { create space for vmt !! }
         { create space for vmt !! }
 {$ifdef OLDVMTSTYLE}
 {$ifdef OLDVMTSTYLE}
-        publicsyms^.datasize:=Sizeof(pointer);
+        publicsyms^.datasize:=target_os.size_of_pointer;
         options:=oo_hasvmt;
         options:=oo_hasvmt;
         vmt_offset:=0;
         vmt_offset:=0;
 {$else }
 {$else }
@@ -2573,7 +2592,7 @@
                +childof^.publicsyms^.datasize;
                +childof^.publicsyms^.datasize;
              if ((options and oo_hasvmt)<>0) and
              if ((options and oo_hasvmt)<>0) and
                 ((c^.options and oo_hasvmt)<>0) then
                 ((c^.options and oo_hasvmt)<>0) then
-               publicsyms^.datasize:=publicsyms^.datasize-Sizeof(pointer);
+               publicsyms^.datasize:=publicsyms^.datasize-target_os.size_of_pointer;
              { if parent has a vmt field then
              { if parent has a vmt field then
                the offset is the same for the child PM }
                the offset is the same for the child PM }
              if ((c^.options and oo_hasvmt)<>0) then
              if ((c^.options and oo_hasvmt)<>0) then
@@ -2633,7 +2652,7 @@
                     publicsyms^.datasize:=publicsyms^.datasize+4-(publicsyms^.datasize mod 4);
                     publicsyms^.datasize:=publicsyms^.datasize+4-(publicsyms^.datasize mod 4);
                end;
                end;
              vmt_offset:=publicsyms^.datasize;
              vmt_offset:=publicsyms^.datasize;
-             publicsyms^.datasize:=publicsyms^.datasize+sizeof(pointer);
+             publicsyms^.datasize:=publicsyms^.datasize+target_os.size_of_pointer;
              options:=options or oo_hasvmt;
              options:=options or oo_hasvmt;
           end;
           end;
      end;
      end;
@@ -2688,7 +2707,7 @@
    function tobjectdef.size : longint;
    function tobjectdef.size : longint;
      begin
      begin
         if (options and oo_is_class)<>0 then
         if (options and oo_is_class)<>0 then
-          size:=sizeof(pointer)
+          size:=target_os.size_of_pointer
 
 
         else
         else
           size:=publicsyms^.datasize;
           size:=publicsyms^.datasize;
@@ -2873,6 +2892,9 @@
           oldrec : pchar;
           oldrec : pchar;
           oldrecsize : longint;
           oldrecsize : longint;
           str_end : string;
           str_end : string;
+{$ifndef nonextfield}
+          cur : psym;
+{$endif nonextfield}
       begin
       begin
         oldrec := stabrecstring;
         oldrec := stabrecstring;
         oldrecsize:=stabrecsize;
         oldrecsize:=stabrecsize;
@@ -2885,22 +2907,40 @@
           strpcopy(strend(stabrecstring),'!1,020,'+childof^.numberstring+';');
           strpcopy(strend(stabrecstring),'!1,020,'+childof^.numberstring+';');
         {virtual table to implement yet}
         {virtual table to implement yet}
         RecOffset := 0;
         RecOffset := 0;
-      {$ifdef tp}
-         publicsyms^.foreach(addname);
-      {$else}
-         publicsyms^.foreach(@addname);
-      {$endif tp}
+{$ifdef nonextfield}
+        {$ifdef tp}
+          publicsyms^.foreach(addname);
+        {$else}
+          publicsyms^.foreach(@addname);
+        {$endif}
+{$else nonextfield}
+         cur:=publicsyms^.root;
+         while assigned(cur) do
+           begin
+              addname(cur);
+              cur:=cur^.nextsym;
+           end;
+{$endif nonextfield}
       if (options and oo_hasvmt) <> 0 then
       if (options and oo_hasvmt) <> 0 then
         if not assigned(childof) or ((childof^.options and oo_hasvmt) = 0) then
         if not assigned(childof) or ((childof^.options and oo_hasvmt) = 0) then
            begin
            begin
               strpcopy(strend(stabrecstring),'$vf'+numberstring+':'+typeglobalnumber('vtblarray')
               strpcopy(strend(stabrecstring),'$vf'+numberstring+':'+typeglobalnumber('vtblarray')
                 +','+tostr(vmt_offset*8)+';');
                 +','+tostr(vmt_offset*8)+';');
            end;
            end;
+{$ifdef nonextfield}
         {$ifdef tp}
         {$ifdef tp}
           publicsyms^.foreach(addprocname);
           publicsyms^.foreach(addprocname);
         {$else}
         {$else}
           publicsyms^.foreach(@addprocname);
           publicsyms^.foreach(@addprocname);
         {$endif tp }
         {$endif tp }
+{$else nonextfield}
+         cur:=publicsyms^.root;
+         while assigned(cur) do
+           begin
+              addprocname(cur);
+              cur:=cur^.nextsym;
+           end;
+{$endif nonextfield}
         if (options and oo_hasvmt) <> 0  then
         if (options and oo_hasvmt) <> 0  then
           begin
           begin
              anc := @self;
              anc := @self;
@@ -3141,7 +3181,17 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.61  1998-10-19 08:55:05  pierre
+  Revision 1.62  1998-10-20 08:06:58  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.61  1998/10/19 08:55:05  pierre
     * wrong stabs info corrected once again !!
     * wrong stabs info corrected once again !!
     + variable vmt offset with vmt field only if required
     + variable vmt offset with vmt field only if required
       implemented now !!!
       implemented now !!!

+ 11 - 3
compiler/symppu.inc

@@ -307,7 +307,6 @@
       end;
       end;
 
 
 
 
-{$ifdef UseBrowser}
     function readsymref : psym;
     function readsymref : psym;
       var
       var
         hd : psym;
         hd : psym;
@@ -316,7 +315,6 @@
         longint(hd):=longint(hd) or (longint(current_ppu^.getword) shl 16);
         longint(hd):=longint(hd) or (longint(current_ppu^.getword) shl 16);
         readsymref:=hd;
         readsymref:=hd;
       end;
       end;
-{$endif}
 
 
 
 
     procedure readsourcefiles;
     procedure readsourcefiles;
@@ -445,7 +443,17 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.23  1998-10-16 13:37:24  florian
+  Revision 1.24  1998-10-20 08:06:59  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.23  1998/10/16 13:37:24  florian
     + switch -FD added to specify the path for utilities
     + switch -FD added to specify the path for utilities
 
 
   Revision 1.22  1998/10/14 13:38:24  peter
   Revision 1.22  1998/10/14 13:38:24  peter

+ 21 - 8
compiler/symsym.inc

@@ -28,6 +28,9 @@
       begin
       begin
          left:=nil;
          left:=nil;
          right:=nil;
          right:=nil;
+{$ifdef nextfield}
+          nextsym:=nil;
+{$endif nextfield}
          setname(n);
          setname(n);
          typ:=abstractsym;
          typ:=abstractsym;
          properties:=current_object_option;
          properties:=current_object_option;
@@ -214,7 +217,7 @@
          setstring(_name,s);
          setstring(_name,s);
       end;
       end;
 
 
-    { for most symbol types ther is nothing to do at all }
+    { for most symbol types there is nothing to do at all }
     procedure tsym.insert_in_data;
     procedure tsym.insert_in_data;
       begin
       begin
       end;
       end;
@@ -944,30 +947,30 @@
               case varspez of
               case varspez of
                  vs_value : begin
                  vs_value : begin
                               if is_open_array(definition) then
                               if is_open_array(definition) then
-                                getsize:=sizeof(pointer)+4
+                                getsize:=target_os.size_of_pointer+target_os.size_of_longint
                               else
                               else
                                 getsize:=definition^.size;
                                 getsize:=definition^.size;
                             end;
                             end;
                    vs_var : begin
                    vs_var : begin
                             { open arrays push also the high valye }
                             { open arrays push also the high valye }
                               if is_open_array(definition) then
                               if is_open_array(definition) then
-                                getsize:=sizeof(pointer)+4
+                                getsize:=target_os.size_of_pointer+target_os.size_of_pointer
                               else
                               else
-                                getsize:=sizeof(pointer);
+                                getsize:=target_os.size_of_pointer;
                             end;
                             end;
                  vs_const : begin
                  vs_const : begin
                               case definition^.deftype of
                               case definition^.deftype of
                              stringdef,
                              stringdef,
                              recorddef,
                              recorddef,
                              objectdef,
                              objectdef,
-                                setdef : getsize:=sizeof(pointer);
+                                setdef : getsize:=target_os.size_of_pointer;
                               arraydef : begin
                               arraydef : begin
                                          { open arrays push also the high valye }
                                          { open arrays push also the high valye }
                                            if (parraydef(definition)^.lowrange=0) and
                                            if (parraydef(definition)^.lowrange=0) and
                                               (parraydef(definition)^.highrange=-1) then
                                               (parraydef(definition)^.highrange=-1) then
-                                             getsize:=sizeof(pointer)+4
+                                             getsize:=target_os.size_of_pointer+target_os.size_of_pointer
                                            else
                                            else
-                                             getsize:=sizeof(pointer);
+                                             getsize:=target_os.size_of_pointer;
                                          end;
                                          end;
                               else
                               else
                                getsize:=definition^.size;
                                getsize:=definition^.size;
@@ -1712,7 +1715,17 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.54  1998-10-19 08:55:07  pierre
+  Revision 1.55  1998-10-20 08:07:00  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.54  1998/10/19 08:55:07  pierre
     * wrong stabs info corrected once again !!
     * wrong stabs info corrected once again !!
     + variable vmt offset with vmt field only if required
     + variable vmt offset with vmt field only if required
       implemented now !!!
       implemented now !!!

+ 14 - 1
compiler/symsymh.inc

@@ -39,6 +39,9 @@
           typ        : tsymtyp;
           typ        : tsymtyp;
           _name      : pchar;
           _name      : pchar;
           left,right : psym;
           left,right : psym;
+{$ifndef nonextfield}
+          nextsym    : psym;
+{$endif nextfield}
           speedvalue : longint;
           speedvalue : longint;
           properties : symprop;
           properties : symprop;
           owner      : psymtable;
           owner      : psymtable;
@@ -315,7 +318,17 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-10-08 17:17:34  pierre
+  Revision 1.4  1998-10-20 08:07:02  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.3  1998/10/08 17:17:34  pierre
     * current_module old scanner tagged as invalid if unit is recompiled
     * current_module old scanner tagged as invalid if unit is recompiled
     + added ppheap for better info on tracegetmem of heaptrc
     + added ppheap for better info on tracegetmem of heaptrc
       (adds line column and file index)
       (adds line column and file index)

+ 34 - 2
compiler/systems.pas

@@ -120,7 +120,9 @@ unit systems;
           Cprefix   : string[2];
           Cprefix   : string[2];
           newline   : string[2];
           newline   : string[2];
           endian    : tendian;
           endian    : tendian;
-          stackalignment : longint;
+          stackalignment : {longint this is a little overkill no ?? }byte;
+          size_of_pointer : byte;
+          size_of_longint : byte;
           use_function_relative_addresses : boolean;
           use_function_relative_addresses : boolean;
        end;
        end;
 
 
@@ -222,6 +224,8 @@ implementation
             newline      : #13#10;
             newline      : #13#10;
             endian       : endian_little;
             endian       : endian_little;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : true
             use_function_relative_addresses : true
           ),
           ),
           (
           (
@@ -238,6 +242,8 @@ implementation
             newline      : #13#10;
             newline      : #13#10;
             endian       : endian_little;
             endian       : endian_little;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : true
             use_function_relative_addresses : true
           ),
           ),
           (
           (
@@ -254,6 +260,8 @@ implementation
             newline      : #10;
             newline      : #10;
             endian       : endian_little;
             endian       : endian_little;
             stackalignment : 4;
             stackalignment : 4;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : true
             use_function_relative_addresses : true
           ),
           ),
           (
           (
@@ -270,6 +278,8 @@ implementation
             newline      : #13#10;
             newline      : #13#10;
             endian       : endian_little;
             endian       : endian_little;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : false
             use_function_relative_addresses : false
           ),
           ),
           (
           (
@@ -286,6 +296,8 @@ implementation
             newline      : #13#10;
             newline      : #13#10;
             endian       : endian_little;
             endian       : endian_little;
             stackalignment : 4;
             stackalignment : 4;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : true
             use_function_relative_addresses : true
           ),
           ),
           (
           (
@@ -302,6 +314,8 @@ implementation
             newline      : #10;
             newline      : #10;
             endian       : endian_big;
             endian       : endian_big;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : false
             use_function_relative_addresses : false
           ),
           ),
           (
           (
@@ -318,6 +332,8 @@ implementation
             newline      : #10;
             newline      : #10;
             endian       : endian_big;
             endian       : endian_big;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : false
             use_function_relative_addresses : false
           ),
           ),
           (
           (
@@ -334,6 +350,8 @@ implementation
             newline      : #13;
             newline      : #13;
             endian       : endian_big;
             endian       : endian_big;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : false
             use_function_relative_addresses : false
           ),
           ),
           (
           (
@@ -350,6 +368,8 @@ implementation
             newline      : #10;
             newline      : #10;
             endian       : endian_big;
             endian       : endian_big;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : true
             use_function_relative_addresses : true
           ),
           ),
           (
           (
@@ -366,6 +386,8 @@ implementation
             newline      : #10;
             newline      : #10;
             endian       : endian_big;
             endian       : endian_big;
             stackalignment : 2;
             stackalignment : 2;
+            size_of_pointer : 4;
+            size_of_longint : 4;
             use_function_relative_addresses : false
             use_function_relative_addresses : false
           )
           )
           );
           );
@@ -1152,7 +1174,17 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  1998-10-16 08:51:54  peter
+  Revision 1.47  1998-10-20 08:07:04  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.46  1998/10/16 08:51:54  peter
     + target_os.stackalignment
     + target_os.stackalignment
     + stack can be aligned at 2 or 4 byte boundaries
     + stack can be aligned at 2 or 4 byte boundaries
 
 

+ 24 - 4
compiler/tcadd.pas

@@ -509,13 +509,23 @@ implementation
                 if (psetdef(ld)^.settype<>smallset) and
                 if (psetdef(ld)^.settype<>smallset) and
                    (psetdef(rd)^.settype=smallset) then
                    (psetdef(rd)^.settype=smallset) then
                  begin
                  begin
-                   p^.right:=gentypeconvnode(p^.right,psetdef(p^.left^.resulttype));
+                   if (p^.right^.treetype=setconstn) then
+                     begin
+                        t:=gensetconstnode(p^.right^.value_set,psetdef(p^.left^.resulttype));
+                        t^.left:=p^.right^.left;
+                        putnode(p^.right);
+                        p^.right:=t;
+                     end
+                   else
+                     p^.right:=gentypeconvnode(p^.right,psetdef(p^.left^.resulttype));
                    firstpass(p^.right);
                    firstpass(p^.right);
                  end;
                  end;
 
 
-                { do constant evalution }
+                { do constant evaluation }
                 if (p^.right^.treetype=setconstn) and
                 if (p^.right^.treetype=setconstn) and
-                   (p^.left^.treetype=setconstn) then
+                   not assigned(p^.right^.left) and
+                   (p^.left^.treetype=setconstn) and
+                   not assigned(p^.left^.left) then
                   begin
                   begin
                      new(resultset);
                      new(resultset);
                      case p^.treetype of
                      case p^.treetype of
@@ -905,7 +915,17 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  1998-10-14 12:53:39  peter
+  Revision 1.5  1998-10-20 08:07:05  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.4  1998/10/14 12:53:39  peter
     * fixed small tp7 things
     * fixed small tp7 things
     * boolean:=longbool and longbool fixed
     * boolean:=longbool and longbool fixed
 
 

+ 13 - 3
compiler/tree.pas

@@ -308,7 +308,7 @@ unit tree;
   implementation
   implementation
 
 
     uses
     uses
-       verbose,files,types;
+       systems,verbose,files,types;
 
 
 
 
     function getnode : ptree;
     function getnode : ptree;
@@ -1151,7 +1151,7 @@ unit tree;
          p^.para_offset:=0;
          p^.para_offset:=0;
          p^.para_size:=p^.inlineprocdef^.para_size;
          p^.para_size:=p^.inlineprocdef^.para_size;
          if ret_in_param(p^.inlineprocdef^.retdef) then
          if ret_in_param(p^.inlineprocdef^.retdef) then
-           p^.para_size:=p^.para_size+sizeof(pointer);
+           p^.para_size:=p^.para_size+target_os.size_of_pointer;
          { copy args }
          { copy args }
          p^.left:=getcopy(code);
          p^.left:=getcopy(code);
          p^.registers32:=code^.registers32;
          p^.registers32:=code^.registers32;
@@ -1620,7 +1620,17 @@ unit tree;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  1998-10-08 17:17:37  pierre
+  Revision 1.47  1998-10-20 08:07:07  pierre
+    * several memory corruptions due to double freemem solved
+      => never use p^.loc.location:=p^.left^.loc.location;
+    + finally I added now by default
+      that ra386dir translates global and unit symbols
+    + added a first field in tsymtable and
+      a nextsym field in tsym
+      (this allows to obtain ordered type info for
+      records and objects in gdb !)
+
+  Revision 1.46  1998/10/08 17:17:37  pierre
     * current_module old scanner tagged as invalid if unit is recompiled
     * current_module old scanner tagged as invalid if unit is recompiled
     + added ppheap for better info on tracegetmem of heaptrc
     + added ppheap for better info on tracegetmem of heaptrc
       (adds line column and file index)
       (adds line column and file index)