Explorar o código

* ensure that the llvmst is initialised before using a field's llvmfieldnr
(and at the same time take advantage of this to perform a sanity check)

git-svn-id: trunk@31061 -

Jonas Maebe %!s(int64=10) %!d(string=hai) anos
pai
achega
b176ed9f80
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      compiler/llvm/nllvmcon.pas

+ 4 - 0
compiler/llvm/nllvmcon.pas

@@ -99,6 +99,7 @@ implementation
         srsymtable: tsymtable;
         srsymtable: tsymtable;
         offset: pint;
         offset: pint;
         field: tfieldvarsym;
         field: tfieldvarsym;
+        llvmfield: tllvmshadowsymtableentry;
         dataptrdef: tdef;
         dataptrdef: tdef;
         reg: tregister;
         reg: tregister;
         href: treference;
         href: treference;
@@ -121,6 +122,9 @@ implementation
         offset:=ctai_typedconstbuilder.get_string_symofs(stringtype,winlikewidestring);
         offset:=ctai_typedconstbuilder.get_string_symofs(stringtype,winlikewidestring);
         { field corresponding to this offset }
         { field corresponding to this offset }
         field:=trecordsymtable(strrecdef.symtable).findfieldbyoffset(offset);
         field:=trecordsymtable(strrecdef.symtable).findfieldbyoffset(offset);
+        llvmfield:=trecordsymtable(strrecdef.symtable).llvmst[field];
+        if llvmfield.fieldoffset<>field.fieldoffset then
+          internalerror(2015061001);
         { pointerdef to the string data array }
         { pointerdef to the string data array }
         dataptrdef:=getpointerdef(field.vardef);
         dataptrdef:=getpointerdef(field.vardef);
         { load the address of the string data }
         { load the address of the string data }