Browse Source

* fixed a number of (mostly false) warnings regarding uninitialised
variables with -Oodfa

git-svn-id: branches/hlcgllvm@30244 -

Jonas Maebe 10 years ago
parent
commit
765044aede

+ 3 - 1
compiler/aasmcnst.pas

@@ -997,7 +997,9 @@ implementation
                datatcb.emit_tai(Tai_label.Create(result.lab),widecharpointertype);
                { allocate a separate label for the start of the data }
                current_asmdata.getdatalabel(startlab);
-             end;
+             end
+           else
+             internalerror(2015031502);
            result.ofs:=string_symofs;
          end
        else

+ 3 - 0
compiler/llvm/hlcgllvm.pas

@@ -849,6 +849,9 @@ implementation
               invert:=a=0;
             OC_NE:
               invert:=a=1;
+            else
+              { avoid uninitialised warning }
+              internalerror(2015031504);
             end;
           current_asmdata.getjumplabel(falselab);
           fallthroughlab:=falselab;

+ 1 - 0
compiler/llvm/itllvm.pas

@@ -77,6 +77,7 @@ interface
       );
 
       llvm_fpcond2str: array[tllvmfpcmp] of ansistring = (
+      'invalid',
       'false',
       'oeq', 'ogt', 'oge', 'olt', 'ole', 'one', 'ord',
       'ueq', 'ugt', 'uge', 'ult', 'ule', 'une', 'uno',

+ 1 - 0
compiler/llvm/llvmbase.pas

@@ -84,6 +84,7 @@ interface
 
   type
     tllvmfpcmp = (
+      lfc_invalid,
       lfc_false,
       lfc_oeq, lfc_ogt, lfc_oge, lfc_olt, lfc_ole, lfc_one, lfc_ord,
       lfc_ueq, lfc_ugt, lfc_uge, lfc_ult, lfc_ule, lfc_une, lfc_uno,

+ 6 - 0
compiler/llvm/nllvmadd.pas

@@ -166,6 +166,8 @@ implementation
           cmpop:=OC_EQ;
         unequaln:
           cmpop:=OC_NE;
+        else
+          internalerror(2015031505);
       end;
       if nf_swapped in flags then
         cmpop:=swap_opcmp(cmpop);
@@ -206,6 +208,8 @@ implementation
 
       cmpop:=false;
       singleprec:=tfloatdef(left.resultdef).floattype=s32real;
+      { avoid uninitialised warning }
+      llvmfpcmp:=lfc_invalid;
       case nodetype of
         addn :
           op:=la_fadd;
@@ -233,6 +237,8 @@ implementation
                 llvmfpcmp:=lfc_oeq;
               unequaln:
                 llvmfpcmp:=lfc_one;
+              else
+                internalerror(2015031506);
             end;
           end;
         else

+ 4 - 0
compiler/llvm/nllvmmem.pas

@@ -140,6 +140,8 @@ implementation
       locref:=nil;
       if not arraytopointerconverted then
         begin
+          { avoid uninitialised warning }
+          arrptrelementdef:=nil;
           { the result is currently a pointer to left.resultdef (the array type)
              -> convert it into a pointer to an element inside this array }
           getarrelementptrdef;
@@ -153,6 +155,8 @@ implementation
       if (resultdef.typ=floatdef) and
          (tfloatdef(resultdef).floattype=s80real) then
        begin
+         { avoid uninitialised warning }
+         arrptrelementdef:=nil;
          getarrelementptrdef;
          hreg:=hlcg.getaddressregister(current_asmdata.CurrAsmList,getpointerdef(resultdef));
          hlcg.a_load_reg_reg(current_asmdata.CurrAsmList,arrptrelementdef,getpointerdef(resultdef),locref^.base,hreg);

+ 4 - 1
compiler/llvm/tgllvm.pas

@@ -109,7 +109,10 @@ implementation
           begin
             oldfileinfo:=current_filepos;
             current_filepos:=current_procinfo.procdef.fileinfo;
-          end;
+          end
+        else
+          { avoid uninitialised warning later }
+          oldfileinfo.line:=0;
         alloclist.concat(taillvm.op_ref_size(la_alloca,ref,def));
         if assigned(current_procinfo) then
           current_filepos:=oldfileinfo;

+ 1 - 0
compiler/ngtcon.pas

@@ -565,6 +565,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                      begin
                        ll.lab:=nil;
                        ll.ofs:=0;
+                       winlike:=false;
                      end
                    else
                      begin

+ 1 - 0
compiler/symdef.pas

@@ -4052,6 +4052,7 @@ implementation
         inherited create(n,recorddef);
         { if we specified a name, then we'll probably want to look up the
           type again by name too -> create typesym }
+        ts:=nil;
         if definedname then
           begin
             ts:=ctypesym.create(n,self);