瀏覽代碼

* fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables

git-svn-id: trunk@26161 -
florian 11 年之前
父節點
當前提交
4d5119bf1c
共有 96 個文件被更改,包括 465 次插入113 次删除
  1. 1 0
      compiler/aggas.pas
  2. 17 7
      compiler/arm/aasmcpu.pas
  3. 7 7
      compiler/arm/aoptcpu.pas
  4. 6 0
      compiler/arm/cgcpu.pas
  5. 1 0
      compiler/arm/cpupi.pas
  6. 2 0
      compiler/assemble.pas
  7. 4 0
      compiler/avr/cgcpu.pas
  8. 6 6
      compiler/cclasses.pas
  9. 2 0
      compiler/cfileutl.pas
  10. 5 1
      compiler/cg64f32.pas
  11. 1 4
      compiler/crefs.pas
  12. 9 1
      compiler/cstreams.pas
  13. 4 0
      compiler/dbgdwarf.pas
  14. 1 0
      compiler/dbgstabs.pas
  15. 1 0
      compiler/dbgstabx.pas
  16. 1 0
      compiler/dirparse.pas
  17. 1 0
      compiler/globals.pas
  18. 8 0
      compiler/hlcgobj.pas
  19. 2 0
      compiler/htypechk.pas
  20. 17 7
      compiler/i386/csopt386.pas
  21. 1 0
      compiler/i386/daopt386.pas
  22. 3 2
      compiler/i386/popt386.pas
  23. 1 0
      compiler/i386/rropt386.pas
  24. 3 1
      compiler/jvm/hlcgcpu.pas
  25. 4 1
      compiler/jvm/jvmdef.pas
  26. 2 0
      compiler/jvm/njvmadd.pas
  27. 3 0
      compiler/jvm/pjvm.pas
  28. 17 1
      compiler/nadd.pas
  29. 4 0
      compiler/ncal.pas
  30. 5 0
      compiler/ncgadd.pas
  31. 2 0
      compiler/ncgbas.pas
  32. 3 0
      compiler/ncgcnv.pas
  33. 2 0
      compiler/ncgcon.pas
  34. 18 0
      compiler/ncgflw.pas
  35. 9 0
      compiler/ncginl.pas
  36. 2 0
      compiler/ncgld.pas
  37. 2 0
      compiler/ncgmat.pas
  38. 11 7
      compiler/ncgmem.pas
  39. 1 0
      compiler/ncgopt.pas
  40. 2 0
      compiler/ncgrtti.pas
  41. 6 0
      compiler/ncgset.pas
  42. 6 0
      compiler/ncgvmt.pas
  43. 6 2
      compiler/ncnv.pas
  44. 6 4
      compiler/ncon.pas
  45. 11 12
      compiler/ngtcon.pas
  46. 7 1
      compiler/ninl.pas
  47. 2 0
      compiler/nmem.pas
  48. 2 0
      compiler/nset.pas
  49. 1 0
      compiler/objcgutl.pas
  50. 5 0
      compiler/ogbase.pas
  51. 1 0
      compiler/ogcoff.pas
  52. 1 0
      compiler/ogelf.pas
  53. 1 0
      compiler/optcse.pas
  54. 1 0
      compiler/optdead.pas
  55. 3 0
      compiler/options.pas
  56. 1 0
      compiler/opttail.pas
  57. 2 1
      compiler/pdecl.pas
  58. 1 0
      compiler/pdecobj.pas
  59. 10 0
      compiler/pdecsub.pas
  60. 5 0
      compiler/pdecvar.pas
  61. 5 0
      compiler/pexpr.pas
  62. 6 1
      compiler/pgenutil.pas
  63. 2 0
      compiler/pinline.pas
  64. 1 0
      compiler/pmodules.pas
  65. 4 2
      compiler/powerpc/aoptcpu.pas
  66. 10 0
      compiler/powerpc/cgcpu.pas
  67. 2 1
      compiler/powerpc/cpupara.pas
  68. 7 4
      compiler/powerpc64/cgcpu.pas
  69. 4 0
      compiler/powerpc64/nppcadd.pas
  70. 2 1
      compiler/powerpc64/nppccnv.pas
  71. 20 18
      compiler/powerpc64/nppcmat.pas
  72. 1 0
      compiler/ppcgen/cgppc.pas
  73. 4 0
      compiler/ppcgen/ngppcadd.pas
  74. 3 0
      compiler/ppu.pas
  75. 13 3
      compiler/pstatmnt.pas
  76. 2 0
      compiler/ptconst.pas
  77. 3 0
      compiler/ptype.pas
  78. 2 0
      compiler/rautils.pas
  79. 4 2
      compiler/scandir.pas
  80. 25 6
      compiler/scanner.pas
  81. 2 0
      compiler/script.pas
  82. 6 5
      compiler/sparc/cgcpu.pas
  83. 12 0
      compiler/symdef.pas
  84. 5 1
      compiler/symtable.pas
  85. 4 1
      compiler/systems/t_bsd.pas
  86. 3 0
      compiler/systems/t_win.pas
  87. 2 2
      compiler/wpobase.pas
  88. 7 0
      compiler/x86/aasmcpu.pas
  89. 9 0
      compiler/x86/cgx86.pas
  90. 8 0
      compiler/x86/nx86add.pas
  91. 3 1
      compiler/x86/nx86mem.pas
  92. 4 0
      compiler/x86/nx86set.pas
  93. 1 0
      compiler/x86/rax86.pas
  94. 3 0
      compiler/x86_64/cpupara.pas
  95. 3 0
      compiler/x86_64/nx64add.pas
  96. 4 0
      compiler/x86_64/nx64flw.pas

+ 1 - 0
compiler/aggas.pas

@@ -1518,6 +1518,7 @@ implementation
 
       begin
         pos:=0;
+        instring:=false;
         for i:=1 to hp.len do
           begin
             if pos=0 then

+ 17 - 7
compiler/arm/aasmcpu.pas

@@ -770,8 +770,7 @@ implementation
             else
               result:=operand_read;
           A_STREX:
-            if opnr in [0,1,2] then
-              result:=operand_write;
+            result:=operand_write;
           else
             internalerror(200403151);
         end;
@@ -1057,20 +1056,28 @@ implementation
                             inc(penalty,multiplier);
                             hp:=tai(hp.next);
                           end;
-                      end;
+                      end
+                    else
+                      penalty:=0;
                   A_IT:
                     if GenerateThumb2Code then
-                      penalty:=multiplier;
+                      penalty:=multiplier
+                    else
+                      internalerror(2013112920);
                   A_ITE,
                   A_ITT:
                     if GenerateThumb2Code then
-                      penalty:=2*multiplier;
+                      penalty:=2*multiplier
+                    else
+                      internalerror(2013112919);
                   A_ITEE,
                   A_ITTE,
                   A_ITET,
                   A_ITTT:
                     if GenerateThumb2Code then
-                      penalty:=3*multiplier;
+                      penalty:=3*multiplier
+                    else
+                      internalerror(2013112918);
                   A_ITEEE,
                   A_ITTEE,
                   A_ITETE,
@@ -1080,7 +1087,9 @@ implementation
                   A_ITETT,
                   A_ITTTT:
                     if GenerateThumb2Code then
-                      penalty:=4*multiplier;
+                      penalty:=4*multiplier
+                    else
+                      internalerror(2013112917);
                   else
                     penalty:=0;
                 end;
@@ -2102,6 +2111,7 @@ implementation
 
       begin
         bytes:=$0;
+        i_field:=0;
         { evaluate and set condition code }
 
         { condition code allowed? }

+ 7 - 7
compiler/arm/aoptcpu.pas

@@ -45,7 +45,7 @@ Type
       reloaded with a new value or it is deallocated afterwards }
     function RegEndOfLife(reg: TRegister;p: taicpu): boolean;
     { gets the next tai object after current that contains info relevant
-      to the optimizer in p1 which used the given register or does a 
+      to the optimizer in p1 which used the given register or does a
       change in program flow.
       If there is none, it returns false and
       sets p1 to nil                                                     }
@@ -605,7 +605,7 @@ Implementation
                           begin
                             DebugMsg('Peephole StrLdr2StrMov 1 done', hp1);
                             asml.remove(hp1);
-                            hp1.free;                            
+                            hp1.free;
                           end
                         else
                           begin
@@ -1103,9 +1103,9 @@ Implementation
                                         [taicpu(p).condition], [PF_None]) and
                        (not ((GenerateThumb2Code) and
                              (taicpu(hp1).opcode in [A_SBC]) and
-                             (((taicpu(hp1).ops=3) and 
+                             (((taicpu(hp1).ops=3) and
                                MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[1]^.reg)) or
-                              ((taicpu(hp1).ops=2) and 
+                              ((taicpu(hp1).ops=2) and
                                MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[0]^.reg))))) and
                        (assigned(FindRegDealloc(taicpu(p).oper[0]^.reg,tai(hp1.Next))) or
                          regLoadedWithNewValue(taicpu(p).oper[0]^.reg, hp1)) and
@@ -1259,7 +1259,7 @@ Implementation
                       Often we see shifts and then a superfluous mov to another register
                       In the future this might be handled in RedundantMovProcess when it uses RegisterTracking
                     }
-                    if (taicpu(p).opcode = A_MOV) and 
+                    if (taicpu(p).opcode = A_MOV) and
                         GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) then
                       RemoveSuperfluousMove(p, hp1, 'MovMov2Mov');
                   end;
@@ -1526,7 +1526,7 @@ Implementation
                         p:=hp1;
                       end;
                   end;
-{$ifdef dummy}                  
+{$ifdef dummy}
                 A_MVN:
                   begin
                     {
@@ -1568,7 +1568,7 @@ Implementation
                         p:=hp1;
                       end;
                   end;
-{$endif dummy}                                    
+{$endif dummy}
                 A_UXTB:
                   begin
                     {

+ 6 - 0
compiler/arm/cgcpu.pas

@@ -1752,6 +1752,7 @@ unit cgcpu;
         { call instruction does not put anything on the stack }
         stackmisalignment:=0;
         tarmprocinfo(current_procinfo).stackpaddingreg:=High(TSuperRegister);
+        lastfloatreg:=RS_NO;
         if not(nostackframe) then
           begin
             firstfloatreg:=RS_NO;
@@ -1978,7 +1979,9 @@ unit cgcpu;
           begin
             stackmisalignment:=0;
             firstfloatreg:=RS_NO;
+            lastfloatreg:=RS_NO;
             mmregs:=[];
+            saveregs:=[];
             case current_settings.fputype of
               fpu_fpa,
               fpu_fpa10,
@@ -2271,6 +2274,7 @@ unit cgcpu;
         cg.a_label(current_procinfo.aktlocaldata,l);
         tmpref.symboldata:=current_procinfo.aktlocaldata.last;
         piclabel:=nil;
+        tmpreg:=NR_NO;
 
         indirection_done:=false;
         if assigned(ref.symbol) then
@@ -4712,6 +4716,7 @@ unit cgcpu;
         if not(nostackframe) then
           begin
             firstfloatreg:=RS_NO;
+            lastfloatreg:=RS_NO;
             { save floating point registers? }
             for r:=RS_F0 to RS_F7 do
               if r in rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall) then
@@ -4816,6 +4821,7 @@ unit cgcpu;
             stackmisalignment:=0;
             { restore floating point register }
             firstfloatreg:=RS_NO;
+            lastfloatreg:=RS_NO;
             { save floating point registers? }
             for r:=RS_F0 to RS_F7 do
               if r in rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall) then

+ 1 - 0
compiler/arm/cpupi.pas

@@ -154,6 +154,7 @@ unit cpupi;
                 begin
                   { save floating point registers? }
                   firstfloatreg:=RS_NO;
+                  lastfloatreg:=RS_NO;
                   regs:=cg.rg[R_FPUREGISTER].used_in_proc-paramanager.get_volatile_registers_fpu(pocall_stdcall);
                   for r:=RS_F0 to RS_F7 do
                     if r in regs then

+ 2 - 0
compiler/assemble.pas

@@ -1357,6 +1357,8 @@ Implementation
         relative_reloc: boolean;
       begin
         fillchar(zerobuf,sizeof(zerobuf),0);
+        fillchar(objsym,sizeof(objsym),0);
+        fillchar(objsymend,sizeof(objsymend),0);
         { main loop }
         while assigned(hp) do
          begin

+ 4 - 0
compiler/avr/cgcpu.pas

@@ -1197,6 +1197,8 @@ unit cgcpu;
                   swapped:=true;
                   cmp_op:=OC_A;
                 end;
+              else
+                internalerror(2013113006);
             end;
 
             if swapped then
@@ -1249,6 +1251,8 @@ unit cgcpu;
               swapped:=true;
               cmp_op:=OC_A;
             end;
+          else
+            internalerror(2013113007);
         end;
         if swapped then
           begin

+ 6 - 6
compiler/cclasses.pas

@@ -87,13 +87,13 @@ type
     procedure Put(Index: Integer; Item: Pointer);
     procedure SetCapacity(NewCapacity: Integer);
     procedure SetCount(NewCount: Integer);
-    Procedure RaiseIndexError(Index : Integer);
+    Procedure RaiseIndexError(Index : Integer);{$ifndef VER2_6}noreturn;{$endif VER2_6}
   public
     destructor Destroy; override;
     function Add(Item: Pointer): Integer;
     procedure Clear;
     procedure Delete(Index: Integer);
-    class procedure Error(const Msg: string; Data: PtrInt);
+    class procedure Error(const Msg: string; Data: PtrInt);{$ifndef VER2_6}noreturn;{$endif VER2_6}
     procedure Exchange(Index1, Index2: Integer);
     function Expand: TFPList;
     function Extract(item: Pointer): Pointer;
@@ -224,7 +224,7 @@ type
     function HashOfIndex(Index: Integer): LongWord;
     function GetNextCollision(Index: Integer): Integer;
     procedure Delete(Index: Integer);
-    class procedure Error(const Msg: string; Data: PtrInt);
+    class procedure Error(const Msg: string; Data: PtrInt);{$ifndef VER2_6}noreturn;{$endif VER2_6}
     function Expand: TFPHashList;
     function Extract(item: Pointer): Pointer;
     function IndexOf(Item: Pointer): Integer;
@@ -649,7 +649,7 @@ implementation
                TFPObjectList (Copied from rtl/objpas/classes/lists.inc)
 *****************************************************************************}
 
-procedure TFPList.RaiseIndexError(Index : Integer);
+procedure TFPList.RaiseIndexError(Index : Integer);{$ifndef VER2_6}noreturn;{$endif VER2_6}
 begin
   Error(SListIndexError, Index);
 end;
@@ -745,7 +745,7 @@ begin
   end;
 end;
 
-class procedure TFPList.Error(const Msg: string; Data: PtrInt);
+class procedure TFPList.Error(const Msg: string; Data: PtrInt);{$ifndef VER2_6}noreturn;{$endif VER2_6}
 begin
   Raise EListError.CreateFmt(Msg,[Data]) at get_caller_addr(get_frame), get_caller_frame(get_frame);
 end;
@@ -1443,7 +1443,7 @@ begin
     Self.Delete(Result);
 end;
 
-class procedure TFPHashList.Error(const Msg: string; Data: PtrInt);
+class procedure TFPHashList.Error(const Msg: string; Data: PtrInt);{$ifndef VER2_6}noreturn;{$endif VER2_6}
 begin
   Raise EListError.CreateFmt(Msg,[Data])  at get_caller_addr(get_frame), get_caller_frame(get_frame);
 end;

+ 2 - 0
compiler/cfileutl.pas

@@ -764,6 +764,7 @@ end;
   begin
     oldpos := 1;
     slashPos := Pos('/', path);
+    TranslatePathToMac:='';
     if (slashPos <> 0) then   {its a unix path}
       begin
         if slashPos = 1 then
@@ -1479,6 +1480,7 @@ end;
         inquotes:=false;
         result:='';
         i:=1;
+        temp:='';
         while i<=length(QuotedStr) do
           begin
             case QuotedStr[i] of

+ 5 - 1
compiler/cg64f32.pas

@@ -861,7 +861,11 @@ unit cg64f32;
                begin
                  current_asmdata.getjumplabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,-1,hreg,neglabel);
-               end;
+               end
+             else
+               { we do not have dynamic dfa, so avoid a warning below about the unused
+                 neglabel }
+               neglabel:=nil;
              { For all other values we have a range check error }
              cg.a_call_name(list,'fpc_rangeerror',false);
 

+ 1 - 4
compiler/crefs.pas

@@ -50,11 +50,8 @@ begin
 end;
 
 Function TRefItem.GetCopy : TLinkedListItem;
-var
-  NR : TRefItem;
 begin
-  NR.Create(RefInfo);
-  GetCopy:=NR;
+  Result:=TRefItem.Create(RefInfo);
 end;
 
 procedure TRefLinkedList.WriteToPPU;

+ 9 - 1
compiler/cstreams.pas

@@ -450,6 +450,11 @@ begin
           l:=0;
          System.Seek(FHandle,l);
        end;
+     else
+       begin
+         CStreamError:=103;
+         l:=Offset;
+       end;
    end;
   {$pop}
   CStreamError:=IOResult;
@@ -549,7 +554,10 @@ begin
     Result:=FMemory
   else
     If NewCapacity=0 then
-      FreeMem (FMemory,Fcapacity)
+      begin
+        FreeMem (FMemory,Fcapacity);
+        Result:=nil;
+      end
     else
       begin
       GetMem (Result,NewCapacity);

+ 4 - 0
compiler/dbgdwarf.pas

@@ -2330,6 +2330,8 @@ implementation
         has_high_reg : boolean;
         dreg,dreghigh : byte;
       begin
+        blocksize:=0;
+        dreghigh:=0;
         { external symbols can't be resolved at link time, so we
           can't generate stabs for them
 
@@ -2886,6 +2888,8 @@ implementation
               templist.free;
               exit;
             end;
+          else
+            internalerror(2013120111);
         end;
 
         append_entry(DW_TAG_variable,false,[

+ 1 - 0
compiler/dbgstabs.pas

@@ -241,6 +241,7 @@ implementation
       len:=0;
       varcounter:=0;
       varptr:=@varvaluedata[0];
+      varvalues[0]:=nil;
       while i<=length(s) do
         begin
           if (s[i]='$') and (i<length(s)) then

+ 1 - 0
compiler/dbgstabx.pas

@@ -274,6 +274,7 @@ implementation
       if vo_is_external in sym.varoptions then
         exit;
       ismem:=not(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_MMREGISTER,LOC_CMMREGISTER,LOC_FPUREGISTER,LOC_CFPUREGISTER]);
+      isglobal:=false;
       if ismem then
         isglobal:=current_asmdata.RefAsmSymbol(sym.mangledname).bind=AB_GLOBAL;
 

+ 1 - 0
compiler/dirparse.pas

@@ -255,6 +255,7 @@ implementation
         opt   : ttargetswitch;
       begin
         result:=true;
+        value:='';
         repeat
           tok:=GetToken(s,',');
           if tok='' then

+ 1 - 0
compiler/globals.pas

@@ -1295,6 +1295,7 @@ implementation
 {$endif need_path_search}
      begin
        localexepath:=GetEnvironmentVariable('PPC_EXEC_PATH');
+       exeName := '';
        if localexepath='' then
          begin
            exeName := FixFileName(system.paramstr(0));

+ 8 - 0
compiler/hlcgobj.pas

@@ -1550,6 +1550,8 @@ implementation
                   tmpreg:=getintregister(list,locsize);
                   a_load_const_reg(list,locsize,loc.value,tmpreg);
                 end;
+              else
+                internalerror(2013112909);
             end;
             a_bit_test_reg_reg_reg(list,bitnumbersize,locsize,destsize,bitnumber,tmpreg,destreg);
           end;
@@ -2217,7 +2219,9 @@ implementation
       tmpreg: tregister;
       subsetregdef: torddef;
       stopbit: byte;
+
     begin
+      tmpreg:=NR_NO;
       subsetregdef:=cgsize_orddef(sreg.subsetregsize);
       stopbit:=sreg.startbit+sreg.bitlen;
       // on x86(64), 1 shl 32(64) = 1 instead of 0
@@ -3553,6 +3557,8 @@ implementation
           toreg:=getaddressregister(list,regsize);
         R_FPUREGISTER:
           toreg:=getfpuregister(list,regsize);
+        else
+          internalerror(2013112910);
       end;
       a_load_reg_reg(list,regsize,regsize,fromreg,toreg);
     end;
@@ -3568,6 +3574,8 @@ implementation
             toreg:=getaddressregister(list,regsize);
           R_FPUREGISTER:
             toreg:=getfpuregister(list,regsize);
+        else
+          internalerror(2013112915);
         end;
         a_load_reg_reg(list,regsize,regsize,fromreg,toreg);
       end;

+ 2 - 0
compiler/htypechk.pas

@@ -870,6 +870,8 @@ implementation
       begin
         isbinaryoverloaded:=false;
         operpd:=nil;
+        ppn:=nil;
+
         { load easier access variables }
         ld:=tbinarynode(t).left.resultdef;
         rd:=tbinarynode(t).right.resultdef;

+ 17 - 7
compiler/i386/csopt386.pas

@@ -353,6 +353,7 @@ var
 
   function getNextRegToTest(var prev: tai; currentReg: tsuperregister): tsuperregister;
   begin
+    getNextRegToTest := RS_INVALID;
     if not checkingPrevSequences then
       begin
         if (currentreg = RS_INVALID) then
@@ -423,9 +424,13 @@ begin {CheckSequence}
   TmpResult := False;
   FillChar(OrgRegInfo, Sizeof(OrgRegInfo), 0);
   FillChar(startRegInfo, sizeof(startRegInfo), 0);
+  FillChar(HighRegInfo, sizeof(HighRegInfo), 0);
+  FillChar(prevreginfo, sizeof(prevreginfo), 0);
   OrgRegFound := 0;
   HighFound := 0;
   OrgRegResult := False;
+  highPrev := nil;
+  orgPrev := nil;
   with startRegInfo do
     begin
       newRegsEncountered := [RS_EBP, RS_ESP];
@@ -1074,6 +1079,7 @@ var
   prev: tai;
   newOrgRegRState, newOrgRegWState: byte;
 begin
+  newOrgRegwState := 0;
   if getLastInstruction(hp,prev) then
     with ptaiprop(prev.optinfo)^ do
       begin
@@ -1429,6 +1435,7 @@ var
 
 begin
   replacereg := false;
+  readStateChanged := false;
   if canreplacereg(orgsupreg,newsupreg,p,orgregcanbemodified,newregmodified, orgregread, removelast,endp) then
     begin
 {$ifdef replaceregdebug}
@@ -1595,12 +1602,12 @@ var
   regcounter: tsuperregister;
   optimizable: boolean;
 begin
+  memtoreg := NR_NO;
+
   if not getlastinstruction(t,hp) or
      not issimplememloc(ref) then
-    begin
-      memtoreg := NR_NO;
-      exit;
-    end;
+    exit;
+
   p := ptaiprop(hp.optinfo);
   optimizable := false;
   for regcounter := RS_EAX to RS_EDI do
@@ -1832,15 +1839,18 @@ procedure doCSE(asml: TAsmList; First, Last: tai; findPrevSeqs, doSubOpts: boole
  removed immediately because sometimes an instruction needs to be checked in
  two different sequences}
 var cnt, cnt2, {cnt3,} orgNrofMods: longint;
-    p, hp1, hp2, prevSeq: tai;
-    hp4: tai;
-    hp5 : tai;
+    p, hp1, hp2, hp4, hp5, prevSeq: tai;
     reginfo: toptreginfo;
     memreg: tregister;
     regcounter: tsuperregister;
 begin
   p := First;
   SkipHead(p);
+  hp1 := nil;
+  hp2 := nil;
+  hp4 := nil;
+  hp5 := nil;
+  cnt := 0;
   while (p <> Last) do
     begin
       case p.typ of

+ 1 - 0
compiler/i386/daopt386.pas

@@ -901,6 +901,7 @@ var
   Cnt: Word;
 begin
   TmpResult := False;
+  Result := False;
   if supreg = RS_INVALID then
     exit;
   if (p1.typ = ait_instruction) then

+ 3 - 2
compiler/i386/popt386.pas

@@ -853,6 +853,8 @@ begin
                         S_B: v:=$80;
                         S_W: v:=$8000;
                         S_L: v:=aint($80000000);
+                        else
+                          internalerror(2013112905);
                       end;
                       if (taicpu(p).oper[0]^.typ=Top_const) and
                          (taicpu(p).oper[0]^.val=v) and
@@ -1973,10 +1975,9 @@ procedure PeepHoleOptPass2(asml: TAsmList; BlockStart, BlockEnd: tai);
     end;
 
 var
-  p,hp1,hp2: tai;
+  p,hp1,hp2,hp3: tai;
   l : longint;
   condition : tasmcond;
-  hp3: tai;
   UsedRegs, TmpUsedRegs: TRegSet;
   carryadd_opcode: Tasmop;
 

+ 1 - 0
compiler/i386/rropt386.pas

@@ -206,6 +206,7 @@ begin
   sequenceEnd := false;
   reg1Modified := false;
   reg2Modified := false;
+  switchLast := false;
   endP := start;
   while tmpResult and not sequenceEnd do
     begin

+ 3 - 1
compiler/jvm/hlcgcpu.pas

@@ -1711,7 +1711,9 @@ implementation
               if tprocsym(sym).procdeflist.Count<>1 then
                 internalerror(2011071713);
               pd:=tprocdef(tprocsym(sym).procdeflist[0]);
-            end;
+            end
+          else
+            internalerror(2013113008);
           a_load_ref_stack(list,java_jlobject,ref,prepare_stack_for_ref(list,ref,false));
           a_call_name(list,pd,pd.mangledname,nil,false);
           { parameter removed, no result }

+ 4 - 1
compiler/jvm/jvmdef.pas

@@ -282,7 +282,10 @@ implementation
                 s64real:
                   c:='D';
                 else
-                  result:=false;
+                  begin
+                    result:=false;
+                    c:=' ';
+                  end;
               end;
               encodedstr:=encodedstr+c;
             end;

+ 2 - 0
compiler/jvm/njvmadd.pas

@@ -213,6 +213,8 @@ interface
                       end;
                       procname:='CONTAINSALL'
                     end;
+                  else
+                    internalerror(2013120114);
                 end;
               result:=ccallnode.createinternmethod(left,procname,ccallparanode.create(right,nil));
               { for an unequaln, we have to negate the result of equals }

+ 3 - 0
compiler/jvm/pjvm.pas

@@ -80,6 +80,7 @@ implementation
         sstate: tscannerstate;
         needclassconstructor: boolean;
       begin
+        ps:=nil;
         { if there is at least one constructor for a class, do nothing (for
            records, we'll always also need a parameterless constructor) }
         if not is_javaclass(obj) or
@@ -733,6 +734,8 @@ implementation
         conststr: ansistring;
         first: boolean;
       begin
+        result:=nil;
+        esym:=nil;
         case csym.constdef.typ of
           enumdef:
             begin

+ 17 - 1
compiler/nadd.pas

@@ -369,6 +369,10 @@ implementation
         b       : boolean;
       begin
         result:=nil;
+        l1:=0;
+        l2:=0;
+        s1:=nil;
+        s2:=nil;
 
         { load easier access variables }
         rd:=right.resultdef;
@@ -1000,6 +1004,11 @@ implementation
 
       begin
          result:=nil;
+         rlow:=0;
+         llow:=0;
+         rhigh:=0;
+         lhigh:=0;
+
          { avoid any problems with type parameters later on }
          if is_typeparam(left.resultdef) or is_typeparam(right.resultdef) then
            begin
@@ -2144,6 +2153,7 @@ implementation
         cmpfuncname: string;
         para: tcallparanode;
       begin
+        result:=nil;
         { when we get here, we are sure that both the left and the right }
         { node are both strings of the same stringtype (JM)              }
         case nodetype of
@@ -2391,6 +2401,8 @@ implementation
                         right := tempn;
                       end;
                     end;
+                  else
+                    internalerror(2013112911);
                 end;
                 result := ccallnode.createinternres(procname,
                   ccallparanode.create(cordconstnode.create(left.resultdef.size,sinttype,false),
@@ -2628,6 +2640,7 @@ implementation
       begin
         result := nil;
         notnode := false;
+        fdef := nil;
         { In non-emulation mode, real opcodes are
           emitted for floating point values.
         }
@@ -2716,7 +2729,10 @@ implementation
               unequaln:
                 procname:='NE';
               else
-                CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),left.resultdef.typename,right.resultdef.typename);
+                begin
+                  CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),left.resultdef.typename,right.resultdef.typename);
+                  exit;
+                end;
             end;
             case tfloatdef(left.resultdef).floattype of
               s32real:

+ 4 - 0
compiler/ncal.pas

@@ -372,6 +372,7 @@ implementation
       begin
         variantdispatch:=selfnode.resultdef.typ=variantdef;
         result:=internalstatements(statements);
+        result_data:=nil;
 
         useresult := assigned(resultdef) and not is_void(resultdef);
         if useresult then
@@ -1132,6 +1133,7 @@ implementation
          srsym: tsym;
          srsymtable: tsymtable;
        begin
+         srsym:=nil;
          if not searchsym_in_named_module(fromunit,procname,srsym,srsymtable) or
             (srsym.typ<>procsym) then
            Message1(cg_f_unknown_compilerproc,fromunit+'.'+procname);
@@ -2043,6 +2045,7 @@ implementation
           msgsendname:='OBJC_MSGSENDSUPER';
 
         { get the mangled name }
+        srsym:=nil;
         if not searchsym_in_named_module('OBJC',msgsendname,srsym,srsymtable) or
            (srsym.typ<>procsym) or
            (tprocsym(srsym).ProcdefList.count<>1) then
@@ -3793,6 +3796,7 @@ implementation
       begin
         { parameters }
         para := tcallparanode(left);
+        pushconstaddr := false;
         while assigned(para) do
           begin
             if (para.parasym.typ = paravarsym) and

+ 5 - 0
compiler/ncgadd.pas

@@ -94,6 +94,9 @@ interface
         isjump     : boolean;
         otl,ofl    : tasmlabel;
       begin
+        otl:=nil;
+        ofl:=nil;
+
         { calculate the operator which is more difficult }
         firstcomplex(self);
 
@@ -739,6 +742,8 @@ interface
               checkoverflow:=true;
               cgop:=OP_SUB;
             end;
+          else
+            internalerror(2013120104);
         end;
 
        checkoverflow:=

+ 2 - 0
compiler/ncgbas.pas

@@ -359,6 +359,8 @@ interface
         oldflowcontrol : tflowcontrol;
       begin
         location_reset(location,LOC_VOID,OS_NO);
+        oldflowcontrol:=[];
+        oldexitlabel:=nil;
 
         { replace exitlabel? }
         if nf_block_with_exit in flags then

+ 3 - 0
compiler/ncgcnv.pas

@@ -686,6 +686,7 @@ interface
          hd : tobjectdef;
          ImplIntf : TImplementedInterface;
       begin
+         l1:=nil;
          location_reset(location,LOC_REGISTER,OS_ADDR);
          case left.location.loc of
             LOC_CREFERENCE,
@@ -727,6 +728,8 @@ interface
            end;
          if hd=nil then
            internalerror(2002081301);
+         if l1=nil then
+           internalerror(2013120101);
          cg.a_label(current_asmdata.CurrAsmList,l1);
       end;
 

+ 2 - 0
compiler/ncgcon.pas

@@ -364,6 +364,8 @@ implementation
                           pc[len]:=#0;
                           current_asmdata.asmlists[al_typedconsts].concat(Tai_string.Create_pchar(pc,len+1));
                         end;
+                      else
+                        internalerror(2013120103);
                    end;
                    lab_str:=lastlabel.lab;
                    entry^.Data:=lastlabel.lab;

+ 18 - 0
compiler/ncgflw.pas

@@ -234,6 +234,7 @@ implementation
 
       begin
          location_reset(location,LOC_VOID,OS_NO);
+         hl:=nil;
 
          oldflowcontrol := flowcontrol;
          include(flowcontrol,fc_inflowcontrol);
@@ -435,6 +436,9 @@ implementation
          isjump: boolean;
       begin
          location_reset(location,LOC_VOID,OS_NO);
+         ofl:=nil;
+         otl:=nil;
+
          oldclabel:=current_procinfo.CurrContinueLabel;
          oldblabel:=current_procinfo.CurrBreakLabel;
          current_asmdata.getjumplabel(current_procinfo.CurrContinueLabel);
@@ -1007,6 +1011,11 @@ implementation
          errorexit;
       begin
          location_reset(location,LOC_VOID,OS_NO);
+         exceptflowcontrol:=[];
+         continuetrylabel:=nil;
+         breaktrylabel:=nil;
+         continueexceptlabel:=nil;
+         breakexceptlabel:=nil;
 
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[fc_inflowcontrol];
@@ -1244,6 +1253,10 @@ implementation
       begin
          paraloc1.init;
          location_reset(location,LOC_VOID,OS_NO);
+         oldCurrExitLabel:=nil;
+         continueonlabel:=nil;
+         breakonlabel:=nil;
+         exitonlabel:=nil;
 
          oldflowcontrol:=flowcontrol;
          flowcontrol:=[fc_inflowcontrol];
@@ -1402,6 +1415,11 @@ implementation
          excepttemps : texceptiontemps;
       begin
          location_reset(location,LOC_VOID,OS_NO);
+         tryflowcontrol:=[];
+         oldBreakLabel:=nil;
+         oldContinueLabel:=nil;
+         continuefinallylabel:=nil;
+         breakfinallylabel:=nil;
 
          { check if child nodes do a break/continue/exit }
          oldflowcontrol:=flowcontrol;

+ 9 - 0
compiler/ncginl.pas

@@ -367,6 +367,11 @@ implementation
         begin
           { set defaults }
           addconstant:=true;
+          hregister:=NR_NO;
+{$ifndef cpu64bitalu}
+          hregisterhi:=NR_NO;
+{$endif not cpu64bitalu}
+
           { first secondpass second argument, because if the first arg }
           { is used in that expression then SSL may move it to another }
           { register                                                   }
@@ -606,6 +611,8 @@ implementation
       use_frame_pointer:boolean;
 
     begin
+      frame_reg:=NR_NO;
+
       if left<>nil then
         begin
           secondpass(left);
@@ -687,6 +694,8 @@ implementation
           in_sar_x,
           in_sar_x_y:
             op:=OP_SAR;
+          else
+            internalerror(2013120110);
         end;
 
         hlcg.location_force_reg(current_asmdata.CurrAsmList,op1.location,op1.resultdef,resultdef,true);

+ 2 - 0
compiler/ncgld.pas

@@ -1168,6 +1168,8 @@ implementation
         freetemp,
         dovariant: boolean;
       begin
+        otlabel:=nil;
+        oflabel:=nil;
         if is_packed_array(resultdef) then
           internalerror(200608042);
         dovariant:=

+ 2 - 0
compiler/ncgmat.pas

@@ -431,6 +431,8 @@ implementation
          case nodetype of
            shln: op:=OP_SHL;
            shrn: op:=OP_SHR;
+           else
+             internalerror(2013120102);
          end;
 {$ifdef cpunodefaultint}
         opsize:=left.location.size;

+ 11 - 7
compiler/ncgmem.pas

@@ -223,6 +223,7 @@ implementation
         hp2 : tnode;
         extraoffset : tcgint;
       begin
+         sym:=nil;
          { assume natural alignment, except for packed records }
          if not(resultdef.typ in [recorddef,objectdef]) or
             (tabstractrecordsymtable(tabstractrecorddef(resultdef).symtable).usefieldalignment<>1) then
@@ -315,15 +316,16 @@ implementation
 
     procedure tcgsubscriptnode.pass_generate_code;
       var
-        sym: tasmsymbol;
+        asmsym: tasmsymbol;
         paraloc1 : tcgpara;
         tmpref: treference;
         sref: tsubsetreference;
         offsetcorrection : aint;
         pd : tprocdef;
-        srym : tsym;
+        sym : tsym;
         st : tsymtable;
       begin
+         sym:=nil;
          secondpass(left);
          if codegenerror then
            exit;
@@ -375,10 +377,10 @@ implementation
                     (cs_checkpointer in current_settings.localswitches) and
                     not(cs_compilesystem in current_settings.moduleswitches) then
                   begin
-                    if not searchsym_in_named_module('HEAPTRC','CHECKPOINTER',srym,st) or
-                       (srym.typ<>procsym) then
+                    if not searchsym_in_named_module('HEAPTRC','CHECKPOINTER',sym,st) or
+                       (sym.typ<>procsym) then
                       internalerror(2012010602);
-                    pd:=tprocdef(tprocsym(srym).ProcdefList[0]);
+                    pd:=tprocdef(tprocsym(sym).ProcdefList[0]);
                     paramanager.getintparaloc(pd,1,paraloc1);
                     hlcg.a_load_reg_cgpara(current_asmdata.CurrAsmList,resultdef,location.reference.base,paraloc1);
                     paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
@@ -504,8 +506,8 @@ implementation
                classes can be changed without breaking programs compiled against
                earlier versions)
              }
-             sym:=current_asmdata.RefAsmSymbol(vs.mangledname);
-             reference_reset_symbol(tmpref,sym,0,sizeof(pint));
+             asmsym:=current_asmdata.RefAsmSymbol(vs.mangledname);
+             reference_reset_symbol(tmpref,asmsym,0,sizeof(pint));
              location.reference.index:=cg.getaddressregister(current_asmdata.CurrAsmList);
              cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,location.reference.index);
              { always packrecords C -> natural alignment }
@@ -1038,6 +1040,8 @@ implementation
               if not(location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
                 internalerror(200304237);
               isjump:=(right.expectloc=LOC_JUMP);
+              otl:=nil;
+              ofl:=nil;
               if isjump then
                begin
                  otl:=current_procinfo.CurrTrueLabel;

+ 1 - 0
compiler/ncgopt.pas

@@ -84,6 +84,7 @@ var
   checklength: boolean;
   len : integer;
 begin
+  l:=nil;
   { first, we have to more or less replicate some code from }
   { ti386addnode.pass_generate_code                                     }
   secondpass(left);

+ 2 - 0
compiler/ncgrtti.pas

@@ -699,6 +699,8 @@ implementation
                  vs_var     : paraspec := pfVar;
                  vs_out     : paraspec := pfOut;
                  vs_constref: paraspec := pfConstRef;
+                 else
+                   internalerror(2013112904);
                end;
                { Kylix also seems to always add both pfArray and pfReference
                  in this case

+ 6 - 0
compiler/ncgset.pas

@@ -260,6 +260,10 @@ implementation
          i,numparts : byte;
          needslabel : Boolean;
        begin
+         l2:=nil;
+         ofl:=nil;
+         otl:=nil;
+
          { We check first if we can generate jumps, this can be done
            because the resultdef is already set in firstpass }
 
@@ -800,6 +804,8 @@ implementation
          oldexecutionweight : longint;
       begin
          location_reset(location,LOC_VOID,OS_NO);
+         ofl:=nil;
+         otl:=nil;
 
          oldflowcontrol := flowcontrol;
          include(flowcontrol,fc_inflowcontrol);

+ 6 - 0
compiler/ncgvmt.pas

@@ -800,6 +800,12 @@ implementation
          dmtlabel:=gendmt;
 {$endif WITHDMT}
          templist:=TAsmList.Create;
+         strmessagetable:=nil;
+         interfacetable:=nil;
+         fieldtablelabel:=nil;
+         methodnametable:=nil;
+         intmessagetable:=nil;
+         classnamelabel:=nil;
 
          { write tables for classes, this must be done before the actual
            class is written, because we need the labels defined }

+ 6 - 2
compiler/ncnv.pas

@@ -1584,7 +1584,9 @@ implementation
               CGMessage1(type_e_interface_has_no_guid,tobjectdef(left.resultdef).typename);
             result:=cstringconstnode.createstr(tobjectdef(left.resultdef).iidstr^);
             tstringconstnode(result).changestringtype(cshortstringtype);
-          end;
+          end
+        else
+          internalerror(2013112913);
       end;
 
 
@@ -1595,7 +1597,9 @@ implementation
             if not(oo_has_valid_guid in tobjectdef(left.resultdef).objectoptions) then
               CGMessage1(type_e_interface_has_no_guid,tobjectdef(left.resultdef).typename);
             result:=cguidconstnode.create(tobjectdef(left.resultdef).iidguid^);
-          end;
+          end
+        else
+          internalerror(2013112914);
       end;
 
 

+ 6 - 4
compiler/ncon.pas

@@ -1071,7 +1071,7 @@ implementation
                   pw:=pcompilerwidestring(value_str);
                   l2:=len;
                   l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),l2);
-                  getmem(pc,l);   
+                  getmem(pc,l);
                   UnicodeToUtf8(pc,l,PUnicodeChar(pw^.data),l2);
                   len:=l-1;
                   donewidestring(pw);
@@ -1086,7 +1086,7 @@ implementation
                   value_str:=pc;
                 end;
             end
-        else 
+        else
           if (tstringdef(def).stringtype = st_ansistring) and
              not(cst_type in [cst_widestring,cst_unicodestring]) then
             begin
@@ -1100,8 +1100,10 @@ implementation
                     cp2:=current_settings.sourcecodepage;
                 end
               else if (cst_type in [cst_shortstring,cst_conststring,cst_longstring]) then
-                cp2:=current_settings.sourcecodepage;
-              { don't change string if codepages are equal or string length is 0 }  
+                cp2:=current_settings.sourcecodepage
+              else
+                internalerror(2013112916);
+              { don't change string if codepages are equal or string length is 0 }
               if (cp1<>cp2) and (len>0) then
                 begin
                   if cpavailable(cp1) and cpavailable(cp2) then

+ 11 - 12
compiler/ngtcon.pas

@@ -442,6 +442,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         winlike   : boolean;
         hsym      : tconstsym;
       begin
+        strval:='';
         { load strval and strlength of the constant tree }
         if (node.nodetype=stringconstn) or is_wide_or_unicode_string(def) or is_constwidecharnode(node) or
           ((node.nodetype=typen) and is_interfacecorba(ttypenode(node).typedef)) then
@@ -709,6 +710,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
       var
         value : bestreal;
       begin
+        value:=0.0;
         if is_constrealnode(node) then
           value:=trealconstnode(node).value_real
         else if is_constintnode(node) then
@@ -888,14 +890,11 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                        case hp.nodetype of
                          vecn :
                            begin
+                             len:=1;
+                             base:=0;
                              case tvecnode(hp).left.resultdef.typ of
                                stringdef :
-                                 begin
-                                    { this seems OK for shortstring and ansistrings PM }
-                                    { it is wrong for widestrings !! }
-                                    len:=1;
-                                    base:=0;
-                                 end;
+                                 ;
                                arraydef :
                                  begin
                                     if not is_packed_array(tvecnode(hp).left.resultdef) then
@@ -904,12 +903,8 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                                         base:=tarraydef(tvecnode(hp).left.resultdef).lowrange;
                                       end
                                     else
-                                      begin
-                                        Message(parser_e_packed_dynamic_open_array);
-                                        len:=1;
-                                        base:=0;
-                                      end;
-                                 end
+                                      Message(parser_e_packed_dynamic_open_array);
+                                 end;
                                else
                                  Message(parser_e_illegal_expression);
                              end;
@@ -1085,6 +1080,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         int_const: tai_const;
         char_size: integer;
         oldoffset: asizeint;
+        dummy : byte;
       begin
         { dynamic array nil }
         if is_dynamic_array(def) then
@@ -1194,6 +1190,9 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                begin
                  Message(parser_e_illegal_expression);
                  len:=0;
+                 { avoid crash later on }
+                 dummy:=0;
+                 ca:=@dummy;
                end;
              if len>(def.highrange-def.lowrange+1) then
                Message(parser_e_string_larger_array);

+ 7 - 1
compiler/ninl.pas

@@ -645,6 +645,7 @@ implementation
       para:=Tcallparanode(params);
       found_error:=false;
       do_read:=inlinenumber in [in_read_x,in_readln_x,in_readstr_x];
+      name:='';
       while assigned(para) do
         begin
           { is this parameter faulty? }
@@ -1055,6 +1056,7 @@ implementation
       para:=Tcallparanode(params);
       do_read:=inlinenumber in [in_read_x,in_readln_x,in_readstr_x];
       is_rwstr := inlinenumber in [in_readstr_x,in_writestr_x];
+      temp:=nil;
       { add the typesize to the filepara }
       if filepara.resultdef.typ=filedef then
         filepara.right := ccallparanode.create(cordconstnode.create(
@@ -1430,6 +1432,8 @@ implementation
            exit;
          end;
 
+         suffix:='';
+
          { in case we are in a generic definition, we cannot
            do all checks, the parameters might be type parameters }
          if df_generic in current_procinfo.procdef.defoptions then
@@ -1645,7 +1649,9 @@ implementation
               inc(dims);
               ppn:=tcallparanode(ppn.right);
             end;
-         end;
+         end
+        else
+         internalerror(2013112912);
         if dims=0 then
          begin
            CGMessage1(parser_e_wrong_parameter_size,'SetLength');

+ 2 - 0
compiler/nmem.pas

@@ -1038,6 +1038,8 @@ implementation
                     elementdef:=cansichartype;
                   st_shortstring :
                     elementdef:=cansichartype;
+                  else
+                    internalerror(2013112902);
                 end;
                 if right.nodetype=rangen then
                   begin

+ 2 - 0
compiler/nset.pas

@@ -995,6 +995,7 @@ implementation
                begin
                  dispose(hcaselabel);
                  Message(parser_e_double_caselabel);
+                 result:=nil;
                end
           end;
 
@@ -1032,6 +1033,7 @@ implementation
               hcaselabel^._high_str.free;
               dispose(hcaselabel);
               Message(parser_e_double_caselabel);
+              result:=nil;
             end;
         end;
 

+ 1 - 0
compiler/objcgutl.pas

@@ -1016,6 +1016,7 @@ procedure tobjcrttiwriter_nonfragile.gen_objc_ivars(list: tasmlist; objccls: tob
     vis     : TAsmsymbind;
   begin
     ivarslabel:=nil;
+    prefix:='';
 
     vcnt:=0;
     setLength(vars,objccls.symtable.SymList.Count);

+ 5 - 0
compiler/ogbase.pas

@@ -2007,6 +2007,11 @@ implementation
       begin
         indexpos:=0;
         allvals:=avalue;
+        { avoid warnings }
+        bytevalues[0]:=0;
+        twobytevalues[0]:=0;
+        fourbytevalues[0]:=0;
+        eightbytevalues[0]:=0;
         repeat
           commapos:=pos(',',allvals);
           if commapos>0 then

+ 1 - 0
compiler/ogcoff.pas

@@ -2873,6 +2873,7 @@ const pemagic : array[0..3] of byte = (
 {$endif win32}
       begin
         result:=false;
+        fillchar(sechdr,sizeof(sechdr),0);
 {$ifdef win32}
         if (target_info.system=system_x86_64_win64) and
           assigned(Wow64DisableWow64FsRedirection) then

+ 1 - 0
compiler/ogelf.pas

@@ -1705,6 +1705,7 @@ implementation
         FReader:=AReader;
         InputFileName:=AReader.FileName;
         result:=false;
+        strndx:=0;
 
         if not LoadHeader(objData) then
           exit;

+ 1 - 0
compiler/optcse.pas

@@ -269,6 +269,7 @@ unit optcse;
         hp2 : tnode;
       begin
         result:=fen_false;
+        nodes:=nil;
         if n.nodetype in cseinvariant then
           begin
             csedomain:=true;

+ 1 - 0
compiler/optdead.pas

@@ -381,6 +381,7 @@ const
 
 
     begin { twpodeadcodeinfofromexternallinker }
+      objdumpfullname:='';
       fuseaixextractstrings:=false;
       { gnu-nm (e.g., on solaris) }
       symbolprogfound:=findutil('gnm',nmfullname,symbolprogfullpath);

+ 3 - 0
compiler/options.pas

@@ -477,6 +477,8 @@ begin
                  ident:=9;
                  outline:=11;
                end;
+         else
+           internalerror(2013112906);
         end;
         j:=pos('_',s);
         opt:=Copy(s,4,j-4);
@@ -1071,6 +1073,7 @@ begin
                         if l=0 then
                           l:=256;
                         dllmajor:=1;
+                        major:=0;
                         if error=0 then
                           val(copy(dllversion,1,l-1),major,error);
                         if (error=0) and (major>=0) and (major<=$ffff) then

+ 1 - 0
compiler/opttail.pas

@@ -82,6 +82,7 @@ unit opttail;
           result:=false;
           if n=nil then
             exit;
+          usedcallnode:=nil;
           case n.nodetype of
             statementn:
               begin

+ 2 - 1
compiler/pdecl.pas

@@ -454,6 +454,7 @@ implementation
          old_checkforwarddefs:=current_module.checkforwarddefs;
          current_module.checkforwarddefs:=TFPObjectList.Create(false);
          block_type:=bt_type;
+         hdef:=nil;
          repeat
            defpos:=current_tokenpos;
            istyperenaming:=false;
@@ -570,7 +571,7 @@ implementation
                     hdef:=newtype.typedef;
                   end
                  else
-                   message1(parser_h_type_redef,genorgtypename);
+                  message1(parser_h_type_redef,genorgtypename);
                end;
             end;
            { no old type reused ? Then insert this new type }

+ 1 - 0
compiler/pdecobj.pas

@@ -1240,6 +1240,7 @@ implementation
                           types_dec(true)
                         else if object_member_blocktype=bt_const then
                           begin
+                            typedconstswritable:=false;
                             if final_fields then
                               begin
                                 { the value of final fields cannot be changed

+ 10 - 0
compiler/pdecsub.pas

@@ -748,6 +748,9 @@ implementation
           end;
 
       begin
+        sp:='';
+        orgsp:='';
+
         { Save the position where this procedure really starts }
         procstartfilepos:=current_tokenpos;
         old_parse_generic:=parse_generic;
@@ -755,6 +758,7 @@ implementation
         result:=false;
         pd:=nil;
         aprocsym:=nil;
+        srsym:=nil;
 
         consume_proc_name;
 
@@ -1012,6 +1016,9 @@ implementation
         { parse parameters }
         if token=_LKLAMMER then
           begin
+            old_current_structdef:=nil;
+            old_current_genericdef:=nil;
+            old_current_specializedef:=nil;
             { Add ObjectSymtable to be able to find nested type definitions }
             popclass:=0;
             if assigned(pd.struct) and
@@ -1069,6 +1076,9 @@ implementation
             old_parse_generic:=parse_generic;
             { Add ObjectSymtable to be able to find generic type definitions }
             popclass:=0;
+            old_current_structdef:=nil;
+            old_current_genericdef:=nil;
+            old_current_specializedef:=nil;
             if assigned(pd.struct) and
                (pd.parast.symtablelevel>=normal_function_level) and
                not (symtablestack.top.symtabletype in [ObjectSymtable,recordsymtable]) then

+ 5 - 0
compiler/pdecvar.pas

@@ -278,6 +278,7 @@ implementation
 
               hasread:=true;
               haswrite:=true;
+              hdispid:=0;
 
               if try_to_consume(_READONLY) then
                 haswrite:=false
@@ -348,6 +349,7 @@ implementation
           wrongvisibility : boolean;
  {$endif}
       begin
+         result:=nil;
          { Generate temp procdefs to search for matching read/write
            procedures. the readprocdef will store all definitions }
          paranr:=0;
@@ -703,6 +705,7 @@ implementation
                        { make sure we don't let constants mask class fields/
                          methods
                        }
+                       sym:=nil;
                        if (not assigned(astruct) or
                            (search_struct_member(astruct,pattern)=nil)) and
                           searchsym(pattern,sym,srsymtable) and
@@ -872,6 +875,7 @@ implementation
                  exit;
                end;
              found:=false;
+             ImplIntf:=nil;
              for i:=0 to tobjectdef(astruct).ImplementedInterfaces.Count-1 do
                begin
                  ImplIntf:=TImplementedInterface(tobjectdef(astruct).ImplementedInterfaces[i]);
@@ -995,6 +999,7 @@ implementation
       is_external_var:=false;
       is_public_var:=false;
       section_name := '';
+      dll_name := '';
       C_name:=vs.realname;
 
       { macpas specific handling due to some switches}

+ 5 - 0
compiler/pexpr.pas

@@ -2060,6 +2060,8 @@ implementation
                      cst_longstring:
                        { let's see when someone stumbles upon this...}
                        internalerror(201301111);
+                     else
+                       internalerror(2013112903);
                    end;
                    if try_type_helper(p1,strdef) then
                      goto skippointdefcheck;
@@ -2424,6 +2426,7 @@ implementation
                srsym:=generrorsym;
                srsymtable:=nil;
                consume(_ID);
+               unit_found:=false;
              end
            else
              begin
@@ -2764,6 +2767,7 @@ implementation
            old_allow_array_constructor : boolean;
          begin
            buildp:=nil;
+           lastp:=nil;
          { be sure that a least one arrayconstructn is used, also for an
            empty [] }
            if token=_RECKKLAMMER then
@@ -2838,6 +2842,7 @@ implementation
         p1:=nil;
         filepos:=current_tokenpos;
         again:=false;
+        pd:=nil;
         if token=_ID then
          begin
            again:=true;

+ 6 - 1
compiler/pgenutil.pas

@@ -1,7 +1,7 @@
 {
     Copyright (c) 2011
 
-    Contains different functions that are used in the context of 
+    Contains different functions that are used in the context of
     parsing generics.
 
     This program is free software; you can redistribute it and/or modify
@@ -464,6 +464,7 @@ uses
                       for the symbol }
                     if not assigned(tt) then
                       begin
+                      srsym:=nil;
                       if not searchsym(ugenname,srsym,st) or
                           (srsym.typ<>typesym) then
                         begin
@@ -705,6 +706,10 @@ uses
             { Reparse the original type definition }
             if not err then
               begin
+                old_current_specializedef:=nil;
+                old_current_genericdef:=nil;
+                old_current_structdef:=nil;
+
                 if parse_class_parent then
                   begin
                     old_current_structdef:=current_structdef;

+ 2 - 0
compiler/pinline.pas

@@ -358,6 +358,8 @@ implementation
                              if p2.nodetype=ordconstn then
                                begin
                                  found:=false;
+                                 { we do not have dynamic dfa, so avoid warning on variantselectsymbol below }
+                                 variantselectsymbol:=nil;
                                  for i:=0 to high(variantdesc^.branches) do
                                    begin
                                      for j:=0 to high(variantdesc^.branches[i].values) do

+ 1 - 0
compiler/pmodules.pas

@@ -1028,6 +1028,7 @@ type
         globalstate : tglobalstate;
         waitingmodule : tmodule;
       begin
+         fillchar(globalstate,sizeof(tglobalstate),0);
          if not immediate then
            begin
 {$ifdef DEBUG_UNITWAITING}

+ 4 - 2
compiler/powerpc/aoptcpu.pas

@@ -44,7 +44,7 @@ Type
 Implementation
 
   uses
-    cutils, cgbase, cgcpu, cgobj;
+    cutils, verbose, cgbase, cgcpu, cgobj;
 
 const
   calculation_target_op0: array[tasmop] of tasmop = (a_none,
@@ -232,7 +232,7 @@ const
               A_CMPLWI:
                 begin
                   if (taicpu(p).oper[1]^.typ = top_const) and
-                     (taicpu(p).oper[1]^.val = 0) and 
+                     (taicpu(p).oper[1]^.val = 0) and
                      getnextinstruction(p,next1) and
                      (next1.typ = ait_instruction) and
                      (taicpu(next1).opcode = A_MFCR) and
@@ -354,6 +354,8 @@ const
                             shlcount := 32-taicpu(next1).oper[2]^.val;
                             l2 := (-1) shr taicpu(next1).oper[2]^.val;
                           end;
+                        else
+                          internalerror(2013113008);
                       end;
                       l1 := rlwinm2mask((taicpu(p).oper[3]^.val-shlcount) and 31,(taicpu(p).oper[4]^.val-shlcount) and 31);
                       l1 := l1 and l2;

+ 10 - 0
compiler/powerpc/cgcpu.pas

@@ -819,6 +819,9 @@ const
 
         usesgpr := false;
         usesfpr := false;
+        firstregint := RS_NO;
+        firstregfpu := RS_NO;
+
         if not(po_assembler in current_procinfo.procdef.procoptions) then
           begin
             { save link register? }
@@ -961,6 +964,8 @@ const
          localsize: tcgint;
       begin
         { AltiVec context restore, not yet implemented !!! }
+        firstregint:=RS_NO;
+        firstregfpu:=RS_NO;
 
         usesfpr:=false;
         usesgpr:=false;
@@ -1085,6 +1090,8 @@ const
          regcounter2, firstfpureg: Tsuperregister;
     begin
       usesfpr:=false;
+      firstreggpr:=RS_NO;
+      firstregfpu:=RS_NO;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         begin
             { FIXME: has to be R_F14 instad of R_F8 for SYSV-64bit }
@@ -1165,6 +1172,9 @@ const
 
     begin
       usesfpr:=false;
+      firstreggpr:=RS_NO;
+      firstregfpu:=RS_NO;
+
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         begin
           { FIXME: has to be R_F14 instad of R_F8 for SYSV-64bit }

+ 2 - 1
compiler/powerpc/cpupara.pas

@@ -400,7 +400,8 @@ unit cpupara;
                     begin
                       { if a record has only one field and that field is }
                       { non-composite (not array or record), it must be  }
-                      { passed according to the rules of that type.       }
+                      { passed according to the rules of that type.      }
+                      sym:=nil;
                       if tabstractrecordsymtable(tabstractrecorddef(paradef).symtable).has_single_field(sym) and
                          ((sym.vardef.typ=floatdef) or
                           ((target_info.system=system_powerpc_darwin) and

+ 7 - 4
compiler/powerpc64/cgcpu.pas

@@ -267,6 +267,7 @@ var
   i : longint;
   hl : aInt;
 begin
+  result := false;
   neg := false;
   { also try to find negative power of two's by negating if the
    value is negative. low(aInt) is special because it can not be
@@ -651,6 +652,8 @@ begin
         instr := taicpu.op_reg_reg_const_const(A_RLDICL, reg2, reg1, 0, (8-tcgsize2size[tosize])*8);
       OS_S64, OS_64:
         instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
+      else
+        internalerror(2013113007);
     end;
   end else
     instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
@@ -1273,11 +1276,11 @@ var
     if (cs_opt_size in current_settings.optimizerswitches) and
        (target_info.system <> system_powerpc64_darwin) then begin
       mayNeedLRStore := false;
+      if target_info.system=system_powerpc64_aix then
+        opc:=A_BLA
+      else
+        opc:=A_BL;
       if ((fprcount > 0) and (gprcount > 0)) then begin
-        if target_info.system=system_powerpc64_aix then
-          opc:=A_BLA
-        else
-          opc:=A_BL;
         a_op_const_reg_reg(list, OP_SUB, OS_INT, 8 * fprcount, NR_R1, NR_R12);
         a_call_name_direct(list, opc, '_savegpr1_' + intToStr(32-gprcount), false, false, false, false);
         a_call_name_direct(list, opc, '_savefpr_' + intToStr(32-fprcount), false, false, false, false);

+ 4 - 0
compiler/powerpc64/nppcadd.pas

@@ -68,6 +68,8 @@ var
 
   opsize : TCgSize;
 begin
+  tmpreg:=NR_NO;
+
   { get the constant on the right if there is one }
   if (left.location.loc = LOC_CONSTANT) then
     swapleftright;
@@ -244,6 +246,8 @@ begin
               cgop := OP_OR;
             andn:
               cgop := OP_AND;
+            else
+              internalerror(2013120112);
           end;
           if (left.location.loc = LOC_CONSTANT) then
             swapleftright;

+ 2 - 1
compiler/powerpc64/nppccnv.pas

@@ -105,8 +105,9 @@ var
   size: tcgsize;
   signed: boolean;
 begin
-
   location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef));
+  reference_reset(disp2,0);
+  tempconst:=nil;
 
   { the code here comes from the PowerPC Compiler Writer's Guide }
   { * longint to double (works for all rounding modes) }

+ 20 - 18
compiler/powerpc64/nppcmat.pas

@@ -75,8 +75,8 @@ begin
   (*
   // this code replaces all mod nodes by the equivalent div/mul/sub sequence
   // on node level, which might be advantageous when doing CSE on that level
-  // However, optimal modulo code for some cases (in particular a 'x mod 2^n-1' 
-  // operation) can not be expressed using nodes, so this is commented out for now 
+  // However, optimal modulo code for some cases (in particular a 'x mod 2^n-1'
+  // operation) can not be expressed using nodes, so this is commented out for now
   if (nodetype = modn) then begin
     block := internalstatements(statementnode);
 
@@ -92,20 +92,20 @@ begin
       addstatement(statementnode, temp_right);
       addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_right), right.getcopy));
 
-      addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_left), 
+      addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_left),
         caddnode.create(subn, ctemprefnode.create(temp_left),
-        caddnode.create(muln, cmoddivnode.create(divn, ctemprefnode.create(temp_left), ctemprefnode.create(temp_right)), 
+        caddnode.create(muln, cmoddivnode.create(divn, ctemprefnode.create(temp_left), ctemprefnode.create(temp_right)),
         ctemprefnode.create(temp_right)))));
 
       addstatement(statementnode, ctempdeletenode.create(temp_right));
     end else begin
       // in case this is a modulo by a constant operation, do not use a temp for the
       // right hand side, because otherwise the div optimization will not recognize this
-      // fact (and there is no constant propagator/recognizer in the compiler), 
+      // fact (and there is no constant propagator/recognizer in the compiler),
       // resulting in suboptimal code.
-      addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_left), 
+      addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_left),
         caddnode.create(subn, ctemprefnode.create(temp_left),
-        caddnode.create(muln, cmoddivnode.create(divn, ctemprefnode.create(temp_left), right.getcopy), 
+        caddnode.create(muln, cmoddivnode.create(divn, ctemprefnode.create(temp_left), right.getcopy),
           right.getcopy))));
     end;
     addstatement(statementnode, ctempdeletenode.create_normal_temp(temp_left));
@@ -126,7 +126,7 @@ const         { signed   overflow }
   divcgops : array[boolean] of TOpCG = (OP_DIV, OP_IDIV);
   zerocond: tasmcond = (dirhint: DH_Plus; simple: true; cond:C_NE; cr: RS_CR7);
   tcgsize2native : array[OS_8..OS_S128] of tcgsize = (
-    OS_64, OS_64, OS_64, OS_64, OS_NO, 
+    OS_64, OS_64, OS_64, OS_64, OS_NO,
     OS_S64, OS_S64, OS_S64, OS_S64, OS_NO
     );
 var
@@ -137,7 +137,7 @@ var
   size       : TCgSize;
   hl : tasmlabel;
   done: boolean;
-         
+
   procedure genOrdConstNodeMod;
   var
     modreg, maskreg, tempreg : tregister;
@@ -164,19 +164,19 @@ var
         cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, modreg, maskreg, maskreg);
         cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_INT, maskreg, tempreg, resultreg);
       end else begin
-        cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, tordconstnode(right).value-1, numerator, 
+        cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, tordconstnode(right).value-1, numerator,
           resultreg);
       end;
     end else begin
-      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], OS_INT, 
+      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], OS_INT,
         tordconstnode(right).value, numerator, resultreg);
-      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tordconstnode(right).value.svalue, resultreg, 
+      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tordconstnode(right).value.svalue, resultreg,
         resultreg);
       cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, resultreg);
     end;
   end;
 
-         
+
 begin
   secondpass(left);
   secondpass(right);
@@ -201,9 +201,9 @@ begin
   done := false;
   if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype = ordconstn) then begin
     if (nodetype = divn) then
-      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], 
+      cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)],
         size, tordconstnode(right).value, numerator, resultreg)
-    else 
+    else
       genOrdConstNodeMod;
     done := true;
   end;
@@ -215,7 +215,7 @@ begin
       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7,
         right.location.register, 0))
     else begin
-      if (tordconstnode(right).value = 0) then 
+      if (tordconstnode(right).value = 0) then
         internalerror(2005100301);
     end;
     divider := right.location.register;
@@ -245,7 +245,7 @@ begin
     cg.a_label(current_asmdata.CurrAsmList,hl);
   end;
   { unsigned division/module can only overflow in case of division by zero
-   (but checking this overflow flag is more convoluted than performing a  
+   (but checking this overflow flag is more convoluted than performing a
    simple comparison with 0)                                             }
   if is_signed(right.resultdef) then
     cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
@@ -259,7 +259,7 @@ procedure tppcshlshrnode.pass_generate_code;
 
 var
   resultreg, hregister1, hregister2 : tregister;
-  
+
   op: topcg;
   asmop1, asmop2: tasmop;
   shiftval: aint;
@@ -350,6 +350,8 @@ begin
               left.location.reference, src1);
           end;
         end;
+      else
+       internalerror(2013120112);
     end;
     { choose appropriate operand }
     if left.resultdef.typ <> floatdef then begin

+ 1 - 0
compiler/ppcgen/cgppc.pas

@@ -450,6 +450,7 @@ unit cgppc;
         tmpref: treference;
         tmpreg: tregister;
       begin
+        tmpreg:=NR_NO;
         if target_info.system in systems_aix then
           begin
             { load function address in R0, and swap "reg" for R0 }

+ 4 - 0
compiler/ppcgen/ngppcadd.pas

@@ -173,6 +173,8 @@ implementation
       begin
         { calculate the operator which is more difficult }
         firstcomplex(self);
+        otl:=nil;
+        ofl:=nil;
 
         cmpop:=false;
         if (torddef(left.resultdef).ordtype in [pasbool8,bool8bit]) or
@@ -381,6 +383,8 @@ implementation
         opdone,
         cmpop  : boolean;
       begin
+        cgop:=OP_None;
+
         pass_left_and_right;
 
         { when a setdef is passed, it has to be a smallset }

+ 3 - 0
compiler/ppu.pas

@@ -793,6 +793,7 @@ begin
       result:=0;
     end;
 {$else not generic_cpu}
+  result:=4;
   case sizeof(aint) of
     8: result:=getint64;
     4: result:=getlongint;
@@ -846,6 +847,7 @@ begin
       result:=0;
     end;
 {$else not generic_cpu}
+  result:=4;
   case sizeof(aword) of
     8: result:=getqword;
     4: result:=getdword;
@@ -954,6 +956,7 @@ begin
   if entryidx+len>entry.size then
    begin
      error:=true;
+     result:='';
      exit;
    end;
   setlength(result,len);

+ 13 - 3
compiler/pstatmnt.pas

@@ -93,6 +93,7 @@ implementation
 
       begin
          first:=nil;
+         last:=nil;
          while token<>_END do
            begin
               if first=nil then
@@ -297,8 +298,9 @@ implementation
 
       begin
          consume(_REPEAT);
-         first:=nil;
 
+         first:=nil;
+         last:=nil;
          while token<>_UNTIL do
            begin
               if first=nil then
@@ -547,7 +549,10 @@ implementation
          else if try_to_consume(_IN) then
            result:=for_in_loop_create(hloopvar)
          else
-           consume(_ASSIGNMENT); // fail
+           begin
+             consume(_ASSIGNMENT); // fail
+             result:=cerrornode.create;
+           end;
       end;
 
 
@@ -598,6 +603,7 @@ implementation
 
 
       begin
+         calltempnode:=nil;
          p:=comp_expr(true,false);
          do_typecheckpass(p);
 
@@ -636,7 +642,6 @@ implementation
               end
             else
               begin
-                calltempnode:=nil;
                 { complex load, load in temp first }
                 newblock:=internalstatements(newstatement);
                 { when we can't take the address of p, load it in a temp }
@@ -872,6 +877,8 @@ implementation
       begin
          p_default:=nil;
          p_specific:=nil;
+         excepTSymtable:=nil;
+         last:=nil;
 
          { read statements to try }
          consume(_TRY);
@@ -1040,6 +1047,7 @@ implementation
         entrypos : tfileposinfo;
       begin
          Inside_asm_statement:=true;
+         asmstat:=nil;
          if assigned(asmmodeinfos[current_settings.asmmode]) then
            begin
              asmreader:=asmmodeinfos[current_settings.asmmode]^.casmreader.create;
@@ -1116,6 +1124,7 @@ implementation
          s          : TIDString;
       begin
          filepos:=current_tokenpos;
+         code:=nil;
          case token of
            _GOTO :
              begin
@@ -1343,6 +1352,7 @@ implementation
 
       begin
          first:=nil;
+         last:=nil;
          filepos:=current_tokenpos;
          consume(starttoken);
 

+ 2 - 0
compiler/ptconst.pas

@@ -86,6 +86,8 @@ implementation
             else
               current_module.tcinitcode:=restree;
             tcbuilder.free;
+            reslist:=nil;
+            cursectype:=sec_none;
           end;
 
         { Parse hints }

+ 3 - 0
compiler/ptype.pas

@@ -390,6 +390,7 @@ implementation
          srsymtable : tsymtable;
        begin
          dospecialize:=false;
+         srsym:=nil;
          repeat
            again:=false;
              case token of
@@ -1434,6 +1435,8 @@ implementation
         st: tsymtable;
       begin
          def:=nil;
+         v:=0;
+         l:=0;
          if assigned(newsym) then
            name:=newsym.RealName
          else

+ 2 - 0
compiler/rautils.pas

@@ -250,6 +250,7 @@ end;
 Function TExprParse.RPNPop : aint;
 { Get the operand at the top of the RPN stack }
 begin
+  RPNPop:=0;
   if RPNTop > 0 then
    begin
      RPNPop:=RPNStack[RPNTop];
@@ -384,6 +385,7 @@ Function TExprParse.Priority(_Operator : Char) : aint;
 { Return priority of operator }
 { The greater the priority, the higher the precedence }
 begin
+  Priority:=0;
   Case _Operator OF
     '(' :
       Priority:=0;

+ 4 - 2
compiler/scandir.pas

@@ -133,6 +133,7 @@ unit scandir;
     procedure dir_align;
       var
         hs : string;
+        b : byte;
       begin
         current_scanner.skipspace;
         if not(c in ['0'..'9']) then
@@ -162,7 +163,8 @@ unit scandir;
          end
         else
          begin
-           case current_scanner.readval of
+           b:=current_scanner.readval;
+           case b of
              1 : current_settings.packrecords:=1;
              2 : current_settings.packrecords:=2;
              4 : current_settings.packrecords:=4;
@@ -170,7 +172,7 @@ unit scandir;
             16 : current_settings.packrecords:=16;
             32 : current_settings.packrecords:=32;
            else
-            Message1(scan_e_illegal_pack_records,hs);
+            Message1(scan_e_illegal_pack_records,tostr(b));
            end;
          end;
       end;

+ 25 - 6
compiler/scanner.pas

@@ -1143,6 +1143,12 @@ type
                     result:=texprvalue.create_ord(lv shl rv);
                   _OP_SHR:
                     result:=texprvalue.create_ord(lv shr rv);
+                  else
+                    begin
+                      { actually we should never get here but this avoids a warning }
+                      Message(parser_e_illegal_expression);
+                      result:=texprvalue.create_error;
+                    end;
                 end;
               end
             else
@@ -1214,6 +1220,8 @@ type
           end
         else
           result:=texprvalue.create_error;
+        else
+          result:=texprvalue.create_error;
       end;
     end;
 
@@ -1267,6 +1275,8 @@ type
               if b in pconstset(value.valueptr)^ then
                 result:=result+tostr(b)+',';
           end;
+        else
+          internalerror(2013112801);
       end;
     end;
 
@@ -1284,6 +1294,10 @@ type
           dispose(pnormalset(value.valueptr));
         constguid :
           dispose(pguid(value.valueptr));
+        constord :
+          ;
+        else
+          internalerror(2013112802);
       end;
       inherited destroy;
     end;
@@ -1542,6 +1556,7 @@ type
            ns:tnormalset;
         begin
           result:=nil;
+          hasKlammer:=false;
            if current_scanner.preproc_token=_ID then
              begin
                 if current_scanner.preproc_pattern='DEFINED' then
@@ -2598,6 +2613,7 @@ type
 
     function tscannerfile.tempopeninputfile:boolean;
       begin
+        tempopeninputfile:=false;
         if inputfile.is_macro then
           exit;
         tempopeninputfile:=inputfile.tempopen;
@@ -2812,7 +2828,9 @@ type
      else if size=2 then
        result:=tokenreadword
      else if size=4 then
-       result:=tokenreadlongword;
+       result:=tokenreadlongword
+     else
+       internalerror(2013112901);
    end;
 
    procedure tscannerfile.tokenreadset(var b;size : longint);
@@ -3255,14 +3273,12 @@ type
                         mesgnb:=tokenreadsizeint;
                         if mesgnb>0 then
                           Comment(V_Error,'Message recordind not yet supported');
+                        prevmsg:=nil;
                         for i:=1 to mesgnb do
                           begin
                             new(pmsg);
                             if i=1 then
-                              begin
-                                current_settings.pmessage:=pmsg;
-                                prevmsg:=nil;
-                              end
+                              current_settings.pmessage:=pmsg
                             else
                               prevmsg^.next:=pmsg;
                             pmsg^.value:=tokenreadlongint;
@@ -5337,7 +5353,10 @@ exit_label:
                checkpreprocstack;
              end;
            else
-             Illegal_Char(c);
+             begin
+               Illegal_Char(c);
+               readpreproc:=NOTOKEN;
+             end;
          end;
       end;
 

+ 2 - 0
compiler/script.pas

@@ -483,6 +483,8 @@ function GenerateScript(const st: TCmdStr): TAsmScript;
         Result:=TAsmScriptAmiga.Create(st);
       script_mpw :
         Result:=TAsmScriptMPW.Create(st);
+      else
+        internalerror(2013112805);
     end;
   end;
 

+ 6 - 5
compiler/sparc/cgcpu.pas

@@ -351,7 +351,7 @@ implementation
            (a>simm13hi) then
           begin
             if g1_used then
-              GetIntRegister(list,OS_INT)
+              tmpreg:=GetIntRegister(list,OS_INT)
             else
               begin
                 tmpreg:=NR_G1;
@@ -469,7 +469,7 @@ implementation
                       reference_reset_base(ref,index,offset,paraloc.alignment);
                     end;
                   if g1_used then
-                    GetIntRegister(list,OS_INT)
+                    tmpreg:=GetIntRegister(list,OS_INT)
                   else
                     begin
                       tmpreg:=NR_G1;
@@ -825,7 +825,7 @@ implementation
                  tmpref.symbol:=nil;
                  tmpref.base:=hreg;
                  tmpref.refaddr:=addr_no;
-                 list.concat(taicpu.op_ref_reg(A_LD,tmpref,hreg)); 
+                 list.concat(taicpu.op_ref_reg(A_LD,tmpref,hreg));
                  need_got_load:=false;
                 if (href.offset<simm13lo) or
                    (href.offset>simm13hi) then
@@ -891,7 +891,7 @@ implementation
         if need_got then
           list.concat(taicpu.op_reg_reg_reg(A_ADD,r,current_procinfo.got,r));
         if need_got_load then
-          list.concat(taicpu.op_reg_reg(A_LD,r,r)); 
+          list.concat(taicpu.op_reg_reg(A_LD,r,r));
 {$endif}
       end;
 
@@ -922,6 +922,7 @@ implementation
        var
          tmpreg: tregister;
        begin
+         tmpreg:=NR_NO;
          if (fromsize<>tosize) then
            begin
              tmpreg:=reg;
@@ -1591,7 +1592,7 @@ implementation
                 reference_reset_base(href,NR_G1,0,sizeof(pint));
                 list.concat(taicpu.op_ref_reg(A_LD,href,NR_G1));
               end;
-              
+
             list.concat(taicpu.op_reg(A_JMP,NR_G1));
 	    g1_used:=false;
           end;

+ 12 - 0
compiler/symdef.pas

@@ -1160,6 +1160,7 @@ implementation
         hp  : tparavarsym;
       begin
         prefix:='';
+        hp:=nil;
         if not assigned(st) then
          internalerror(200204212);
         { sub procedures }
@@ -2787,6 +2788,8 @@ implementation
          ft_typed,
          ft_untyped :
            savesize:=search_system_type('FILEREC').typedef.size;
+           else
+             internalerror(2013113001);
          end;
       end;
 
@@ -2810,6 +2813,8 @@ implementation
              GetTypeName:='File Of '+typedfiledef.typename;
            ft_text:
              GetTypeName:='Text'
+           else
+             internalerror(2013113002);
          end;
       end;
 
@@ -2823,6 +2828,8 @@ implementation
              getmangledparaname:='FILE$OF$'+typedfiledef.mangledparaname;
            ft_text:
              getmangledparaname:='TEXT'
+           else
+             internalerror(2013113003);
          end;
       end;
 
@@ -2884,6 +2891,8 @@ implementation
              GetTypeName:='Variant';
            vt_olevariant:
              GetTypeName:='OleVariant';
+           else
+             internalerror(2013113004);
          end;
       end;
 
@@ -5052,6 +5061,7 @@ implementation
         oldlen,
         i    : integer;
       begin
+        hp:=nil;
         { we need to use the symtable where the procsym is inserted,
           because that is visible to the world }
         defaultmangledname:=make_mangledname('',procsym.owner,procsym.name);
@@ -6354,6 +6364,8 @@ implementation
                           internalerror(2009092501);
                       end;
                     end;
+                  else
+                    internalerror(2013113005);
                 end;
               end;
             result:=result+objextname^;

+ 5 - 1
compiler/symtable.pas

@@ -427,6 +427,7 @@ implementation
         def : tdef;
         b   : byte;
       begin
+         def:=nil;
          { load start of definition section, which holds the amount of defs }
          if ppufile.readentry<>ibstartdefs then
            Message(unit_f_ppu_read_error);
@@ -469,7 +470,8 @@ implementation
         b   : byte;
         sym : tsym;
       begin
-      { load start of definition section, which holds the amount of defs }
+         sym:=nil;
+         { load start of definition section, which holds the amount of defs }
          if ppufile.readentry<>ibstartsyms then
           Message(unit_f_ppu_read_error);
          { now read the symbols }
@@ -1087,6 +1089,7 @@ implementation
                   while space>0 do
                     begin
                       bestfieldindex:=-1;
+                      bestinsertfieldoffset:=-1;
                       for j:=i+1 to list.count-1 do
                         begin
                           insertfieldvs:=tfieldvarsym(list[j]);
@@ -3107,6 +3110,7 @@ implementation
         srsymtable: tsymtable;
         sym: tsym;
       begin
+        sym:=nil;
         if searchsym_in_named_module(unitname,typename,sym,srsymtable) and
            (sym.typ=typesym) then
           begin

+ 4 - 1
compiler/systems/t_bsd.pas

@@ -336,11 +336,12 @@ Var
 begin
   WriteResponseFile:=False;
   ReOrder:=False;
+  linkdynamic:=False;
   IsDarwin:=target_info.system in systems_darwin;
 { set special options for some targets }
   if not IsDarwin Then
     begin
-      if isdll and 
+      if isdll and
          (target_info.system in systems_bsd) then
         begin
           prtobj:='dllprt0';
@@ -645,6 +646,7 @@ begin
   StripStr:='';
   DynLinkStr:='';
   GCSectionsStr:='';
+  linkscript:=nil;
   { i386_freebsd needs -b elf32-i386-freebsd and -m elf_i386_fbsd
     to avoid creation of a i386:x86_64 arch binary }
 
@@ -778,6 +780,7 @@ var
 begin
   MakeSharedLibrary:=false;
   GCSectionsStr:='';
+  linkscript:=nil;
   if not(cs_link_nolink in current_settings.globalswitches) then
    Message1(exec_i_linking,current_module.sharedlibfilename);
 

+ 3 - 0
compiler/systems/t_win.pas

@@ -325,6 +325,9 @@ implementation
           end;
 
         begin
+          implabel:=nil;
+          idata5label:=nil;
+          textobjsection:=nil;
           objdata:=CreateObjData(cut_normal);
           if not isvar then
             textobjsection:=objdata.createsection(sec_code,'');

+ 2 - 2
compiler/wpobase.pas

@@ -388,8 +388,8 @@ implementation
 
       inherited destroy;
     end;
-    
-    
+
+
   procedure tunitwpoinfobase.resetdefs;
     var
       i: ptrint;

+ 7 - 0
compiler/x86/aasmcpu.pas

@@ -2362,6 +2362,13 @@ implementation
         if objdata.currobjsec.size<>longword(insoffset) then
            internalerror(200130121);
 
+        { those variables are initialized inside local procedures, the dfa cannot handle this yet }
+        currsym:=nil;
+        currabsreloc:=RELOC_NONE;
+        currabsreloc32:=RELOC_NONE;
+        currrelreloc:=RELOC_NONE;
+        currval:=0;
+
         { load data to write }
         codes:=insentry^.code;
 {$ifdef x86_64}

+ 9 - 0
compiler/x86/cgx86.pas

@@ -404,6 +404,7 @@ unit cgx86;
         add_hreg: boolean;
 {$endif not  x86_64}
       begin
+        hreg:=NR_NO;
         { make_simple_ref() may have already been called earlier, and in that
           case make sure we don't perform the PIC-simplifications twice }
         if (ref.refaddr in [addr_pic,addr_pic_no_got]) then
@@ -1564,6 +1565,7 @@ unit cgx86;
         power  : longint;
         href : treference;
       begin
+        power:=0;
         if (op in [OP_MUL,OP_IMUL]) and (size in [OS_32,OS_S32,OS_64,OS_S64]) and
           not(cs_check_overflow in current_settings.localswitches) and
           (a>1) and ispowerof2(int64(a-1),power) and (power in [1..3]) then
@@ -1670,6 +1672,8 @@ unit cgx86;
                       opcode := A_SHR;
                     OP_IDIV:
                       opcode := A_SAR;
+                    else
+                      internalerror(2013112907);
                   end;
                   list.concat(taicpu.op_const_reg(opcode,TCgSize2OpSize[size],power,reg));
                   exit;
@@ -1802,6 +1806,8 @@ unit cgx86;
                       opcode := A_SHR;
                     OP_IDIV:
                       opcode := A_SAR;
+                    else
+                      internalerror(2013112908);
                   end;
                   list.concat(taicpu.op_const_ref(opcode,
                     TCgSize2OpSize[size],power,tmpref));
@@ -2266,6 +2272,9 @@ unit cgx86;
             dstref:=dest;
             srcref:=source;
             r0:=getmmxregister(list);
+            r1:=NR_NO;
+            r2:=NR_NO;
+            r3:=NR_NO;
             a_loadmm_ref_reg(list,OS_M64,OS_M64,srcref,r0,nil);
             if len>=16 then
               begin

+ 8 - 0
compiler/x86/nx86add.pas

@@ -317,6 +317,8 @@ unit nx86add;
                      lten : getresflags:=F_GE;
                      gtn : getresflags:=F_L;
                      gten : getresflags:=F_LE;
+                     else
+                       internalerror(2013120105);
                   end
                 else
                   case nodetype of
@@ -324,6 +326,8 @@ unit nx86add;
                      lten : getresflags:=F_LE;
                      gtn : getresflags:=F_G;
                      gten : getresflags:=F_GE;
+                     else
+                       internalerror(2013120106);
                   end;
              end
            else
@@ -334,6 +338,8 @@ unit nx86add;
                      lten : getresflags:=F_AE;
                      gtn : getresflags:=F_B;
                      gten : getresflags:=F_BE;
+                     else
+                       internalerror(2013120107);
                   end
                 else
                   case nodetype of
@@ -341,6 +347,8 @@ unit nx86add;
                      lten : getresflags:=F_BE;
                      gtn : getresflags:=F_A;
                      gten : getresflags:=F_AE;
+                     else
+                       internalerror(2013120108);
                   end;
              end;
          end;

+ 3 - 1
compiler/x86/nx86mem.pas

@@ -102,7 +102,9 @@ implementation
          else if location.reference.base=NR_NO then
           begin
             if (location.reference.scalefactor > 1) then
-              hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
+              hreg:=cg.getaddressregister(current_asmdata.CurrAsmList)
+            else
+              hreg:=NR_NO;
             case location.reference.scalefactor of
              0,1 : hreg:=location.reference.index;
              2 : cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,1,location.reference.index,hreg);

+ 4 - 0
compiler/x86/nx86set.pas

@@ -375,6 +375,10 @@ implementation
 {$endif i8086}
 
        begin
+         ranges:=false;
+         numparts:=0;
+         fillchar(setparts,sizeof(setparts),0);
+
          { We check first if we can generate jumps, this can be done
            because the resultdef is already set in firstpass }
 

+ 1 - 0
compiler/x86/rax86.pas

@@ -952,6 +952,7 @@ var
   i,asize : longint;
   ai   : taicpu;
 begin
+  ConcatInstruction:=nil;
   if (OpOrder=op_intel) then
     SwapOperands;
 

+ 3 - 0
compiler/x86_64/cpupara.pas

@@ -521,7 +521,10 @@ unit cpupara;
         num: longint;
         isbitpacked: boolean;
       begin
+        size:=0;
+        bitoffset:=0;
         result:=init_aggregate_classification(def,varspez,byte_offset,words,classes);
+
         if (words=0) then
           exit;
 

+ 3 - 0
compiler/x86_64/nx64add.pas

@@ -74,6 +74,9 @@ interface
         cgsize:TCgSize;
         opsize:topsize;
       begin
+        reference_reset(ref,0);
+        reg:=NR_NO;
+
         cgsize:=def_cgsize(resultdef);
         opsize:=TCGSize2OpSize[cgsize];
         case cgsize of

+ 4 - 0
compiler/x86_64/nx64flw.pas

@@ -436,6 +436,10 @@ procedure tx64tryexceptnode.pass_generate_code;
     location_reset(location,LOC_VOID,OS_NO);
 
     oldflowcontrol:=flowcontrol;
+    exceptflowcontrol:=[];
+    continueexceptlabel:=nil;
+    breakexceptlabel:=nil;
+
     flowcontrol:=flowcontrol*[fc_unwind]+[fc_inflowcontrol];
     { this can be called recursivly }
     oldBreakLabel:=nil;