Browse Source

* fix crash with duplicate id

peter 22 years ago
parent
commit
d42645ca0a
2 changed files with 17 additions and 5 deletions
  1. 8 2
      compiler/pdecsub.pas
  2. 9 3
      compiler/pdecvar.pas

+ 8 - 2
compiler/pdecsub.pas

@@ -251,7 +251,10 @@ implementation
                repeat
                  vs:=tvarsym.create(orgpattern,generrortype);
                  currparast.insert(vs);
-                 sc.insert(vs);
+                 if assigned(vs.owner) then
+                  sc.insert(vs)
+                 else
+                  vs.free;
                  consume(_ID);
                until not try_to_consume(_COMMA);
              { read type declaration, force reading for value and const paras }
@@ -2117,7 +2120,10 @@ const
 end.
 {
   $Log$
-  Revision 1.106  2003-03-17 15:54:22  peter
+  Revision 1.107  2003-03-17 18:56:02  peter
+    * fix crash with duplicate id
+
+  Revision 1.106  2003/03/17 15:54:22  peter
     * store symoptions also for procdef
     * check symoptions (private,public) when calculating possible
       overload candidates

+ 9 - 3
compiler/pdecvar.pas

@@ -153,7 +153,10 @@ implementation
              repeat
                vs:=tvarsym.create(orgpattern,generrortype);
                symtablestack.insert(vs);
-               sc.insert(vs);
+               if assigned(vs.owner) then
+                sc.insert(vs)
+               else
+                vs.free;
                consume(_ID);
              until not try_to_consume(_COMMA);
              consume(_COLON);
@@ -336,7 +339,7 @@ implementation
                      consume(_EQUAL);
                      readtypedconst(tt,tconstsym,true);
                      symdone:=true;
-                   end; 
+                   end;
                end;
              { if the symbol is not completely handled, then try to parse the
                hint directives }
@@ -609,7 +612,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.44  2003-01-02 11:14:02  michael
+  Revision 1.45  2003-03-17 18:56:02  peter
+    * fix crash with duplicate id
+
+  Revision 1.44  2003/01/02 11:14:02  michael
   + Patch from peter to support initial values for local variables
 
   Revision 1.43  2002/12/27 15:22:20  peter