浏览代码

* fixed wrong typecasts

peter 21 年之前
父节点
当前提交
7c0b6e129e
共有 5 个文件被更改,包括 56 次插入36 次删除
  1. 7 2
      compiler/ncal.pas
  2. 5 2
      compiler/ncgld.pas
  3. 5 2
      compiler/ncgutil.pas
  4. 34 28
      compiler/pdecsub.pas
  5. 5 2
      compiler/ptconst.pas

+ 7 - 2
compiler/ncal.pas

@@ -2161,12 +2161,14 @@ type
          else
          else
          { not a procedure variable }
          { not a procedure variable }
            begin
            begin
+	      if procdefinition.deftype<>procdef then
+	        internalerror(200411071);
               { calc the correture value for the register }
               { calc the correture value for the register }
               { handle predefined procedures }
               { handle predefined procedures }
               if (procdefinition.proccalloption=pocall_inline) then
               if (procdefinition.proccalloption=pocall_inline) then
                 begin
                 begin
                    { inherit flags }
                    { inherit flags }
-                   current_procinfo.flags := current_procinfo.flags + ((procdefinition as tprocdef).inlininginfo^.flags*inherited_inlining_flags);
+                   current_procinfo.flags := current_procinfo.flags + (tprocdef(procdefinition).inlininginfo^.flags*inherited_inlining_flags);
 
 
                    if assigned(methodpointer) then
                    if assigned(methodpointer) then
                      CGMessage(cg_e_unable_inline_object_methods);
                      CGMessage(cg_e_unable_inline_object_methods);
@@ -2413,7 +2415,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.258  2004-11-08 22:09:58  peter
+  Revision 1.259  2004-11-09 17:26:47  peter
+    * fixed wrong typecasts
+
+  Revision 1.258  2004/11/08 22:09:58  peter
     * tvarsym splitted
     * tvarsym splitted
 
 
   Revision 1.257  2004/11/02 12:55:16  peter
   Revision 1.257  2004/11/02 12:55:16  peter

+ 5 - 2
compiler/ncgld.pas

@@ -364,7 +364,7 @@ implementation
                end;
                end;
             labelsym :
             labelsym :
                begin
                begin
-                  location.reference.symbol:=objectlibrary.newasmsymbol(ttypedconstsym(symtableentry).mangledname,AB_EXTERNAL,AT_FUNCTION);
+                  location.reference.symbol:=objectlibrary.newasmsymbol(tlabelsym(symtableentry).mangledname,AB_EXTERNAL,AT_FUNCTION);
                end;
                end;
             else internalerror(4);
             else internalerror(4);
          end;
          end;
@@ -957,7 +957,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.131  2004-11-08 22:09:59  peter
+  Revision 1.132  2004-11-09 17:26:47  peter
+    * fixed wrong typecasts
+
+  Revision 1.131  2004/11/08 22:09:59  peter
     * tvarsym splitted
     * tvarsym splitted
 
 
   Revision 1.130  2004/11/01 15:32:12  peter
   Revision 1.130  2004/11/01 15:32:12  peter

+ 5 - 2
compiler/ncgutil.pas

@@ -2084,7 +2084,7 @@ implementation
            (po_assembler in pd.procoptions) then
            (po_assembler in pd.procoptions) then
           exit;
           exit;
         { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
         { for localloc <> LOC_REFERENCE, we need regvar support inside inlined procedures }
-        with tlocalvarsym(pd.funcretsym) do
+        with tabstractnormalvarsym(pd.funcretsym) do
           begin
           begin
             localloc.loc:=LOC_REFERENCE;
             localloc.loc:=LOC_REFERENCE;
             localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline));
             localloc.size:=int_cgsize(paramanager.push_size(varspez,vartype.def,pocall_inline));
@@ -2212,7 +2212,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.238  2004-11-08 22:09:59  peter
+  Revision 1.239  2004-11-09 17:26:47  peter
+    * fixed wrong typecasts
+
+  Revision 1.238  2004/11/08 22:09:59  peter
     * tvarsym splitted
     * tvarsym splitted
 
 
   Revision 1.237  2004/11/08 20:23:29  florian
   Revision 1.237  2004/11/08 20:23:29  florian

+ 34 - 28
compiler/pdecsub.pas

@@ -502,7 +502,7 @@ implementation
                       if assigned(defaultvalue) then
                       if assigned(defaultvalue) then
                         begin
                         begin
                           include(defaultvalue.symoptions,sp_internal);
                           include(defaultvalue.symoptions,sp_internal);
-                          tprocdef(pd).parast.insert(defaultvalue);
+                          pd.parast.insert(defaultvalue);
                         end;
                         end;
                       defaultrequired:=true;
                       defaultrequired:=true;
                     end
                     end
@@ -574,6 +574,7 @@ implementation
       var
       var
         orgsp,sp : stringid;
         orgsp,sp : stringid;
         sym : tsym;
         sym : tsym;
+	srsym : tsym;
         srsymtable : tsymtable;
         srsymtable : tsymtable;
         storepos,
         storepos,
         procstartfilepos : tfileposinfo;
         procstartfilepos : tfileposinfo;
@@ -697,10 +698,10 @@ implementation
            repeat
            repeat
              searchagain:=false;
              searchagain:=false;
              akttokenpos:=procstartfilepos;
              akttokenpos:=procstartfilepos;
-             aprocsym:=tprocsym(symtablestack.search(sp));
+             srsym:=tsym(symtablestack.search(sp));
 
 
              if not(parse_only) and
              if not(parse_only) and
-                not assigned(aprocsym) and
+                not assigned(srsym) and
                 (symtablestack.symtabletype=staticsymtable) and
                 (symtablestack.symtabletype=staticsymtable) and
                 assigned(symtablestack.next) and
                 assigned(symtablestack.next) and
                 (symtablestack.next.unitid=0) then
                 (symtablestack.next.unitid=0) then
@@ -712,33 +713,35 @@ implementation
 
 
                    We need to find out if the procedure is global. If it is
                    We need to find out if the procedure is global. If it is
                    global, it is in the global symtable.}
                    global, it is in the global symtable.}
-                 aprocsym:=tprocsym(symtablestack.next.search(sp));
+                 srsym:=tsym(symtablestack.next.search(sp));
                end;
                end;
 
 
              { Check if overloaded is a procsym }
              { Check if overloaded is a procsym }
-             if assigned(aprocsym) and
-                (aprocsym.typ<>procsym) then
-              begin
-                { when the other symbol is a unit symbol then hide the unit
-                  symbol }
-                if (aprocsym.typ=unitsym) then
-                 begin
-                   aprocsym.owner.rename(aprocsym.name,'hidden'+aprocsym.name);
-                   searchagain:=true;
-                 end
-                else
-                 begin
-                   {  we use a different error message for tp7 so it looks more compatible }
-                   if (m_fpc in aktmodeswitches) then
-                    Message1(parser_e_overloaded_no_procedure,aprocsym.realname)
-                   else
-                    tstoredsymtable(symtablestack).DuplicateSym(nil,aprocsym);
-                   { rename the name to an unique name to avoid an
-                     error when inserting the symbol in the symtable }
-                   orgsp:=orgsp+'$'+tostr(aktfilepos.line);
-                   { generate a new aktprocsym }
-                   aprocsym:=nil;
-                 end;
+             if assigned(srsym) then
+	       begin
+	         if srsym.typ=procsym then
+		   aprocsym:=tprocsym(srsym)
+		 else
+                   begin
+                     { when the other symbol is a unit symbol then hide the unit
+                       symbol }
+                     if (srsym.typ=unitsym) then
+                      begin
+                        srsym.owner.rename(srsym.name,'hidden'+srsym.name);
+                        searchagain:=true;
+                      end
+                     else
+                      begin
+                        {  we use a different error message for tp7 so it looks more compatible }
+                        if (m_fpc in aktmodeswitches) then
+                         Message1(parser_e_overloaded_no_procedure,srsym.realname)
+                        else
+                         tstoredsymtable(symtablestack).DuplicateSym(nil,srsym);
+                        { rename the name to an unique name to avoid an
+                          error when inserting the symbol in the symtable }
+                        orgsp:=orgsp+'$'+tostr(aktfilepos.line);
+                      end;
+ 	           end;
               end;
               end;
            until not searchagain;
            until not searchagain;
          end;
          end;
@@ -2263,7 +2266,10 @@ const
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.200  2004-11-08 22:09:59  peter
+  Revision 1.201  2004-11-09 17:26:47  peter
+    * fixed wrong typecasts
+
+  Revision 1.200  2004/11/08 22:09:59  peter
     * tvarsym splitted
     * tvarsym splitted
 
 
   Revision 1.199  2004/11/05 21:16:55  peter
   Revision 1.199  2004/11/05 21:16:55  peter

+ 5 - 2
compiler/ptconst.pas

@@ -427,7 +427,7 @@ implementation
                                else
                                else
                                  Message(parser_e_illegal_expression);
                                  Message(parser_e_illegal_expression);
                              end;
                              end;
-                             hp:=tbinarynode(hp).left;
+                             hp:=tunarynode(hp).left;
                           end;
                           end;
                         srsym:=tloadnode(hp).symtableentry;
                         srsym:=tloadnode(hp).symtableentry;
                         case srsym.typ of
                         case srsym.typ of
@@ -1089,7 +1089,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.95  2004-11-08 22:09:59  peter
+  Revision 1.96  2004-11-09 17:26:47  peter
+    * fixed wrong typecasts
+
+  Revision 1.95  2004/11/08 22:09:59  peter
     * tvarsym splitted
     * tvarsym splitted
 
 
   Revision 1.94  2004/11/01 23:30:11  peter
   Revision 1.94  2004/11/01 23:30:11  peter