Ver Fonte

* tcgcallnode.pass_generate_code: pass the correct vmt pointer type parameter to
location_force_reg when generating code for a call to a virtual class method,
called through a class reference var. This bug went unnoticed so far, because
on all platforms, except i8086 medium and compact memory models, the size of
a vmt pointer is the same as the size of a procvar. Even in the i8086 medium
and compact memory models, the previous code would generate correct code,
because thlcg2ll.a_load_loc_reg uses loc.size (which was correct) in the case
when fromsize=tosize (both of which were wrong, but equal), due to the check
in hlcg2ll.pas:555. Thanks to Jonas for finding this bug!

git-svn-id: trunk@28512 -

nickysn há 11 anos atrás
pai
commit
0f9e8f84bb
1 ficheiros alterados com 1 adições e 2 exclusões
  1. 1 2
      compiler/ncgcal.pas

+ 1 - 2
compiler/ncgcal.pas

@@ -896,8 +896,7 @@ implementation
                  else
                    begin
                      { Load VMT value in register }
-                     { todo: fix vmt type for high level cg }
-                     hlcg.location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,proc_addr_voidptrdef,proc_addr_voidptrdef,false);
+                     hlcg.location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,methodpointer.resultdef,methodpointer.resultdef,false);
                      vmtreg:=methodpointer.location.register;
                      { test validity of VMT }
                      if not(is_interface(tprocdef(procdefinition).struct)) and