浏览代码

* 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
       begin
         pos:=0;
         pos:=0;
+        instring:=false;
         for i:=1 to hp.len do
         for i:=1 to hp.len do
           begin
           begin
             if pos=0 then
             if pos=0 then

+ 17 - 7
compiler/arm/aasmcpu.pas

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

+ 7 - 7
compiler/arm/aoptcpu.pas

@@ -45,7 +45,7 @@ Type
       reloaded with a new value or it is deallocated afterwards }
       reloaded with a new value or it is deallocated afterwards }
     function RegEndOfLife(reg: TRegister;p: taicpu): boolean;
     function RegEndOfLife(reg: TRegister;p: taicpu): boolean;
     { gets the next tai object after current that contains info relevant
     { 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.
       change in program flow.
       If there is none, it returns false and
       If there is none, it returns false and
       sets p1 to nil                                                     }
       sets p1 to nil                                                     }
@@ -605,7 +605,7 @@ Implementation
                           begin
                           begin
                             DebugMsg('Peephole StrLdr2StrMov 1 done', hp1);
                             DebugMsg('Peephole StrLdr2StrMov 1 done', hp1);
                             asml.remove(hp1);
                             asml.remove(hp1);
-                            hp1.free;                            
+                            hp1.free;
                           end
                           end
                         else
                         else
                           begin
                           begin
@@ -1103,9 +1103,9 @@ Implementation
                                         [taicpu(p).condition], [PF_None]) and
                                         [taicpu(p).condition], [PF_None]) and
                        (not ((GenerateThumb2Code) and
                        (not ((GenerateThumb2Code) and
                              (taicpu(hp1).opcode in [A_SBC]) 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
                                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
                                MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[0]^.reg))))) and
                        (assigned(FindRegDealloc(taicpu(p).oper[0]^.reg,tai(hp1.Next))) or
                        (assigned(FindRegDealloc(taicpu(p).oper[0]^.reg,tai(hp1.Next))) or
                          regLoadedWithNewValue(taicpu(p).oper[0]^.reg, hp1)) and
                          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
                       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
                       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
                         GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) then
                       RemoveSuperfluousMove(p, hp1, 'MovMov2Mov');
                       RemoveSuperfluousMove(p, hp1, 'MovMov2Mov');
                   end;
                   end;
@@ -1526,7 +1526,7 @@ Implementation
                         p:=hp1;
                         p:=hp1;
                       end;
                       end;
                   end;
                   end;
-{$ifdef dummy}                  
+{$ifdef dummy}
                 A_MVN:
                 A_MVN:
                   begin
                   begin
                     {
                     {
@@ -1568,7 +1568,7 @@ Implementation
                         p:=hp1;
                         p:=hp1;
                       end;
                       end;
                   end;
                   end;
-{$endif dummy}                                    
+{$endif dummy}
                 A_UXTB:
                 A_UXTB:
                   begin
                   begin
                     {
                     {

+ 6 - 0
compiler/arm/cgcpu.pas

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

+ 2 - 0
compiler/assemble.pas

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

+ 4 - 0
compiler/avr/cgcpu.pas

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

+ 6 - 6
compiler/cclasses.pas

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

+ 2 - 0
compiler/cfileutl.pas

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

+ 5 - 1
compiler/cg64f32.pas

@@ -861,7 +861,11 @@ unit cg64f32;
                begin
                begin
                  current_asmdata.getjumplabel(neglabel);
                  current_asmdata.getjumplabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,-1,hreg,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 }
              { For all other values we have a range check error }
              cg.a_call_name(list,'fpc_rangeerror',false);
              cg.a_call_name(list,'fpc_rangeerror',false);
 
 

+ 1 - 4
compiler/crefs.pas

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

+ 9 - 1
compiler/cstreams.pas

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

+ 4 - 0
compiler/dbgdwarf.pas

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

+ 1 - 0
compiler/dbgstabs.pas

@@ -241,6 +241,7 @@ implementation
       len:=0;
       len:=0;
       varcounter:=0;
       varcounter:=0;
       varptr:=@varvaluedata[0];
       varptr:=@varvaluedata[0];
+      varvalues[0]:=nil;
       while i<=length(s) do
       while i<=length(s) do
         begin
         begin
           if (s[i]='$') and (i<length(s)) then
           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
       if vo_is_external in sym.varoptions then
         exit;
         exit;
       ismem:=not(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_MMREGISTER,LOC_CMMREGISTER,LOC_FPUREGISTER,LOC_CFPUREGISTER]);
       ismem:=not(sym.localloc.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_MMREGISTER,LOC_CMMREGISTER,LOC_FPUREGISTER,LOC_CFPUREGISTER]);
+      isglobal:=false;
       if ismem then
       if ismem then
         isglobal:=current_asmdata.RefAsmSymbol(sym.mangledname).bind=AB_GLOBAL;
         isglobal:=current_asmdata.RefAsmSymbol(sym.mangledname).bind=AB_GLOBAL;
 
 

+ 1 - 0
compiler/dirparse.pas

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

+ 1 - 0
compiler/globals.pas

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

+ 8 - 0
compiler/hlcgobj.pas

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

+ 2 - 0
compiler/htypechk.pas

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

+ 1 - 0
compiler/i386/daopt386.pas

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

+ 3 - 2
compiler/i386/popt386.pas

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

+ 1 - 0
compiler/i386/rropt386.pas

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

+ 3 - 1
compiler/jvm/hlcgcpu.pas

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

+ 4 - 1
compiler/jvm/jvmdef.pas

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

+ 2 - 0
compiler/jvm/njvmadd.pas

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

+ 3 - 0
compiler/jvm/pjvm.pas

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

+ 17 - 1
compiler/nadd.pas

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

+ 4 - 0
compiler/ncal.pas

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

+ 5 - 0
compiler/ncgadd.pas

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

+ 2 - 0
compiler/ncgbas.pas

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

+ 3 - 0
compiler/ncgcnv.pas

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

+ 2 - 0
compiler/ncgcon.pas

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

+ 18 - 0
compiler/ncgflw.pas

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

+ 9 - 0
compiler/ncginl.pas

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

+ 2 - 0
compiler/ncgld.pas

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

+ 2 - 0
compiler/ncgmat.pas

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

+ 11 - 7
compiler/ncgmem.pas

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

+ 1 - 0
compiler/ncgopt.pas

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

+ 2 - 0
compiler/ncgrtti.pas

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

+ 6 - 0
compiler/ncgset.pas

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

+ 6 - 0
compiler/ncgvmt.pas

@@ -800,6 +800,12 @@ implementation
          dmtlabel:=gendmt;
          dmtlabel:=gendmt;
 {$endif WITHDMT}
 {$endif WITHDMT}
          templist:=TAsmList.Create;
          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
          { write tables for classes, this must be done before the actual
            class is written, because we need the labels defined }
            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);
               CGMessage1(type_e_interface_has_no_guid,tobjectdef(left.resultdef).typename);
             result:=cstringconstnode.createstr(tobjectdef(left.resultdef).iidstr^);
             result:=cstringconstnode.createstr(tobjectdef(left.resultdef).iidstr^);
             tstringconstnode(result).changestringtype(cshortstringtype);
             tstringconstnode(result).changestringtype(cshortstringtype);
-          end;
+          end
+        else
+          internalerror(2013112913);
       end;
       end;
 
 
 
 
@@ -1595,7 +1597,9 @@ implementation
             if not(oo_has_valid_guid in tobjectdef(left.resultdef).objectoptions) then
             if not(oo_has_valid_guid in tobjectdef(left.resultdef).objectoptions) then
               CGMessage1(type_e_interface_has_no_guid,tobjectdef(left.resultdef).typename);
               CGMessage1(type_e_interface_has_no_guid,tobjectdef(left.resultdef).typename);
             result:=cguidconstnode.create(tobjectdef(left.resultdef).iidguid^);
             result:=cguidconstnode.create(tobjectdef(left.resultdef).iidguid^);
-          end;
+          end
+        else
+          internalerror(2013112914);
       end;
       end;
 
 
 
 

+ 6 - 4
compiler/ncon.pas

@@ -1071,7 +1071,7 @@ implementation
                   pw:=pcompilerwidestring(value_str);
                   pw:=pcompilerwidestring(value_str);
                   l2:=len;
                   l2:=len;
                   l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),l2);
                   l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),l2);
-                  getmem(pc,l);   
+                  getmem(pc,l);
                   UnicodeToUtf8(pc,l,PUnicodeChar(pw^.data),l2);
                   UnicodeToUtf8(pc,l,PUnicodeChar(pw^.data),l2);
                   len:=l-1;
                   len:=l-1;
                   donewidestring(pw);
                   donewidestring(pw);
@@ -1086,7 +1086,7 @@ implementation
                   value_str:=pc;
                   value_str:=pc;
                 end;
                 end;
             end
             end
-        else 
+        else
           if (tstringdef(def).stringtype = st_ansistring) and
           if (tstringdef(def).stringtype = st_ansistring) and
              not(cst_type in [cst_widestring,cst_unicodestring]) then
              not(cst_type in [cst_widestring,cst_unicodestring]) then
             begin
             begin
@@ -1100,8 +1100,10 @@ implementation
                     cp2:=current_settings.sourcecodepage;
                     cp2:=current_settings.sourcecodepage;
                 end
                 end
               else if (cst_type in [cst_shortstring,cst_conststring,cst_longstring]) then
               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
               if (cp1<>cp2) and (len>0) then
                 begin
                 begin
                   if cpavailable(cp1) and cpavailable(cp2) then
                   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;
         winlike   : boolean;
         hsym      : tconstsym;
         hsym      : tconstsym;
       begin
       begin
+        strval:='';
         { load strval and strlength of the constant tree }
         { load strval and strlength of the constant tree }
         if (node.nodetype=stringconstn) or is_wide_or_unicode_string(def) or is_constwidecharnode(node) or
         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
           ((node.nodetype=typen) and is_interfacecorba(ttypenode(node).typedef)) then
@@ -709,6 +710,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
       var
       var
         value : bestreal;
         value : bestreal;
       begin
       begin
+        value:=0.0;
         if is_constrealnode(node) then
         if is_constrealnode(node) then
           value:=trealconstnode(node).value_real
           value:=trealconstnode(node).value_real
         else if is_constintnode(node) then
         else if is_constintnode(node) then
@@ -888,14 +890,11 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                        case hp.nodetype of
                        case hp.nodetype of
                          vecn :
                          vecn :
                            begin
                            begin
+                             len:=1;
+                             base:=0;
                              case tvecnode(hp).left.resultdef.typ of
                              case tvecnode(hp).left.resultdef.typ of
                                stringdef :
                                stringdef :
-                                 begin
-                                    { this seems OK for shortstring and ansistrings PM }
-                                    { it is wrong for widestrings !! }
-                                    len:=1;
-                                    base:=0;
-                                 end;
+                                 ;
                                arraydef :
                                arraydef :
                                  begin
                                  begin
                                     if not is_packed_array(tvecnode(hp).left.resultdef) then
                                     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;
                                         base:=tarraydef(tvecnode(hp).left.resultdef).lowrange;
                                       end
                                       end
                                     else
                                     else
-                                      begin
-                                        Message(parser_e_packed_dynamic_open_array);
-                                        len:=1;
-                                        base:=0;
-                                      end;
-                                 end
+                                      Message(parser_e_packed_dynamic_open_array);
+                                 end;
                                else
                                else
                                  Message(parser_e_illegal_expression);
                                  Message(parser_e_illegal_expression);
                              end;
                              end;
@@ -1085,6 +1080,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         int_const: tai_const;
         int_const: tai_const;
         char_size: integer;
         char_size: integer;
         oldoffset: asizeint;
         oldoffset: asizeint;
+        dummy : byte;
       begin
       begin
         { dynamic array nil }
         { dynamic array nil }
         if is_dynamic_array(def) then
         if is_dynamic_array(def) then
@@ -1194,6 +1190,9 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                begin
                begin
                  Message(parser_e_illegal_expression);
                  Message(parser_e_illegal_expression);
                  len:=0;
                  len:=0;
+                 { avoid crash later on }
+                 dummy:=0;
+                 ca:=@dummy;
                end;
                end;
              if len>(def.highrange-def.lowrange+1) then
              if len>(def.highrange-def.lowrange+1) then
                Message(parser_e_string_larger_array);
                Message(parser_e_string_larger_array);

+ 7 - 1
compiler/ninl.pas

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

+ 2 - 0
compiler/nmem.pas

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

+ 2 - 0
compiler/nset.pas

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

+ 1 - 0
compiler/objcgutl.pas

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

+ 5 - 0
compiler/ogbase.pas

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

+ 1 - 0
compiler/ogcoff.pas

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

+ 1 - 0
compiler/ogelf.pas

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

+ 1 - 0
compiler/optcse.pas

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

+ 1 - 0
compiler/optdead.pas

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

+ 3 - 0
compiler/options.pas

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

+ 1 - 0
compiler/opttail.pas

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

+ 2 - 1
compiler/pdecl.pas

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

+ 1 - 0
compiler/pdecobj.pas

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

+ 10 - 0
compiler/pdecsub.pas

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

+ 5 - 0
compiler/pdecvar.pas

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

+ 5 - 0
compiler/pexpr.pas

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

+ 6 - 1
compiler/pgenutil.pas

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

+ 2 - 0
compiler/pinline.pas

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

+ 1 - 0
compiler/pmodules.pas

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

+ 4 - 2
compiler/powerpc/aoptcpu.pas

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

+ 10 - 0
compiler/powerpc/cgcpu.pas

@@ -819,6 +819,9 @@ const
 
 
         usesgpr := false;
         usesgpr := false;
         usesfpr := false;
         usesfpr := false;
+        firstregint := RS_NO;
+        firstregfpu := RS_NO;
+
         if not(po_assembler in current_procinfo.procdef.procoptions) then
         if not(po_assembler in current_procinfo.procdef.procoptions) then
           begin
           begin
             { save link register? }
             { save link register? }
@@ -961,6 +964,8 @@ const
          localsize: tcgint;
          localsize: tcgint;
       begin
       begin
         { AltiVec context restore, not yet implemented !!! }
         { AltiVec context restore, not yet implemented !!! }
+        firstregint:=RS_NO;
+        firstregfpu:=RS_NO;
 
 
         usesfpr:=false;
         usesfpr:=false;
         usesgpr:=false;
         usesgpr:=false;
@@ -1085,6 +1090,8 @@ const
          regcounter2, firstfpureg: Tsuperregister;
          regcounter2, firstfpureg: Tsuperregister;
     begin
     begin
       usesfpr:=false;
       usesfpr:=false;
+      firstreggpr:=RS_NO;
+      firstregfpu:=RS_NO;
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         begin
         begin
             { FIXME: has to be R_F14 instad of R_F8 for SYSV-64bit }
             { FIXME: has to be R_F14 instad of R_F8 for SYSV-64bit }
@@ -1165,6 +1172,9 @@ const
 
 
     begin
     begin
       usesfpr:=false;
       usesfpr:=false;
+      firstreggpr:=RS_NO;
+      firstregfpu:=RS_NO;
+
       if not (po_assembler in current_procinfo.procdef.procoptions) then
       if not (po_assembler in current_procinfo.procdef.procoptions) then
         begin
         begin
           { FIXME: has to be R_F14 instad of R_F8 for SYSV-64bit }
           { 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
                     begin
                       { if a record has only one field and that field is }
                       { if a record has only one field and that field is }
                       { non-composite (not array or record), it must be  }
                       { 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
                       if tabstractrecordsymtable(tabstractrecorddef(paradef).symtable).has_single_field(sym) and
                          ((sym.vardef.typ=floatdef) or
                          ((sym.vardef.typ=floatdef) or
                           ((target_info.system=system_powerpc_darwin) and
                           ((target_info.system=system_powerpc_darwin) and

+ 7 - 4
compiler/powerpc64/cgcpu.pas

@@ -267,6 +267,7 @@ var
   i : longint;
   i : longint;
   hl : aInt;
   hl : aInt;
 begin
 begin
+  result := false;
   neg := false;
   neg := false;
   { also try to find negative power of two's by negating if the
   { 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
    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);
         instr := taicpu.op_reg_reg_const_const(A_RLDICL, reg2, reg1, 0, (8-tcgsize2size[tosize])*8);
       OS_S64, OS_64:
       OS_S64, OS_64:
         instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
         instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
+      else
+        internalerror(2013113007);
     end;
     end;
   end else
   end else
     instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
     instr := taicpu.op_reg_reg(A_MR, reg2, reg1);
@@ -1273,11 +1276,11 @@ var
     if (cs_opt_size in current_settings.optimizerswitches) and
     if (cs_opt_size in current_settings.optimizerswitches) and
        (target_info.system <> system_powerpc64_darwin) then begin
        (target_info.system <> system_powerpc64_darwin) then begin
       mayNeedLRStore := false;
       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 ((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_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, '_savegpr1_' + intToStr(32-gprcount), false, false, false, false);
         a_call_name_direct(list, opc, '_savefpr_' + intToStr(32-fprcount), 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;
   opsize : TCgSize;
 begin
 begin
+  tmpreg:=NR_NO;
+
   { get the constant on the right if there is one }
   { get the constant on the right if there is one }
   if (left.location.loc = LOC_CONSTANT) then
   if (left.location.loc = LOC_CONSTANT) then
     swapleftright;
     swapleftright;
@@ -244,6 +246,8 @@ begin
               cgop := OP_OR;
               cgop := OP_OR;
             andn:
             andn:
               cgop := OP_AND;
               cgop := OP_AND;
+            else
+              internalerror(2013120112);
           end;
           end;
           if (left.location.loc = LOC_CONSTANT) then
           if (left.location.loc = LOC_CONSTANT) then
             swapleftright;
             swapleftright;

+ 2 - 1
compiler/powerpc64/nppccnv.pas

@@ -105,8 +105,9 @@ var
   size: tcgsize;
   size: tcgsize;
   signed: boolean;
   signed: boolean;
 begin
 begin
-
   location_reset(location, LOC_FPUREGISTER, def_cgsize(resultdef));
   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 }
   { the code here comes from the PowerPC Compiler Writer's Guide }
   { * longint to double (works for all rounding modes) }
   { * 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
   // 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
   // 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
   if (nodetype = modn) then begin
     block := internalstatements(statementnode);
     block := internalstatements(statementnode);
 
 
@@ -92,20 +92,20 @@ begin
       addstatement(statementnode, temp_right);
       addstatement(statementnode, temp_right);
       addstatement(statementnode, cassignmentnode.create(ctemprefnode.create(temp_right), right.getcopy));
       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(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)))));
         ctemprefnode.create(temp_right)))));
 
 
       addstatement(statementnode, ctempdeletenode.create(temp_right));
       addstatement(statementnode, ctempdeletenode.create(temp_right));
     end else begin
     end else begin
       // in case this is a modulo by a constant operation, do not use a temp for the
       // 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
       // 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.
       // 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(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))));
           right.getcopy))));
     end;
     end;
     addstatement(statementnode, ctempdeletenode.create_normal_temp(temp_left));
     addstatement(statementnode, ctempdeletenode.create_normal_temp(temp_left));
@@ -126,7 +126,7 @@ const         { signed   overflow }
   divcgops : array[boolean] of TOpCG = (OP_DIV, OP_IDIV);
   divcgops : array[boolean] of TOpCG = (OP_DIV, OP_IDIV);
   zerocond: tasmcond = (dirhint: DH_Plus; simple: true; cond:C_NE; cr: RS_CR7);
   zerocond: tasmcond = (dirhint: DH_Plus; simple: true; cond:C_NE; cr: RS_CR7);
   tcgsize2native : array[OS_8..OS_S128] of tcgsize = (
   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
     OS_S64, OS_S64, OS_S64, OS_S64, OS_NO
     );
     );
 var
 var
@@ -137,7 +137,7 @@ var
   size       : TCgSize;
   size       : TCgSize;
   hl : tasmlabel;
   hl : tasmlabel;
   done: boolean;
   done: boolean;
-         
+
   procedure genOrdConstNodeMod;
   procedure genOrdConstNodeMod;
   var
   var
     modreg, maskreg, tempreg : tregister;
     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_AND, OS_INT, modreg, maskreg, maskreg);
         cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_INT, maskreg, tempreg, resultreg);
         cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_INT, maskreg, tempreg, resultreg);
       end else begin
       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);
           resultreg);
       end;
       end;
     end else begin
     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);
         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);
         resultreg);
       cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, resultreg);
       cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, resultreg);
     end;
     end;
   end;
   end;
 
 
-         
+
 begin
 begin
   secondpass(left);
   secondpass(left);
   secondpass(right);
   secondpass(right);
@@ -201,9 +201,9 @@ begin
   done := false;
   done := false;
   if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype = ordconstn) then begin
   if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype = ordconstn) then begin
     if (nodetype = divn) then
     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)
         size, tordconstnode(right).value, numerator, resultreg)
-    else 
+    else
       genOrdConstNodeMod;
       genOrdConstNodeMod;
     done := true;
     done := true;
   end;
   end;
@@ -215,7 +215,7 @@ begin
       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7,
       current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7,
         right.location.register, 0))
         right.location.register, 0))
     else begin
     else begin
-      if (tordconstnode(right).value = 0) then 
+      if (tordconstnode(right).value = 0) then
         internalerror(2005100301);
         internalerror(2005100301);
     end;
     end;
     divider := right.location.register;
     divider := right.location.register;
@@ -245,7 +245,7 @@ begin
     cg.a_label(current_asmdata.CurrAsmList,hl);
     cg.a_label(current_asmdata.CurrAsmList,hl);
   end;
   end;
   { unsigned division/module can only overflow in case of division by zero
   { 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)                                             }
    simple comparison with 0)                                             }
   if is_signed(right.resultdef) then
   if is_signed(right.resultdef) then
     cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
     cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
@@ -259,7 +259,7 @@ procedure tppcshlshrnode.pass_generate_code;
 
 
 var
 var
   resultreg, hregister1, hregister2 : tregister;
   resultreg, hregister1, hregister2 : tregister;
-  
+
   op: topcg;
   op: topcg;
   asmop1, asmop2: tasmop;
   asmop1, asmop2: tasmop;
   shiftval: aint;
   shiftval: aint;
@@ -350,6 +350,8 @@ begin
               left.location.reference, src1);
               left.location.reference, src1);
           end;
           end;
         end;
         end;
+      else
+       internalerror(2013120112);
     end;
     end;
     { choose appropriate operand }
     { choose appropriate operand }
     if left.resultdef.typ <> floatdef then begin
     if left.resultdef.typ <> floatdef then begin

+ 1 - 0
compiler/ppcgen/cgppc.pas

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

+ 4 - 0
compiler/ppcgen/ngppcadd.pas

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

+ 3 - 0
compiler/ppu.pas

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

+ 13 - 3
compiler/pstatmnt.pas

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

+ 2 - 0
compiler/ptconst.pas

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

+ 3 - 0
compiler/ptype.pas

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

+ 2 - 0
compiler/rautils.pas

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

+ 4 - 2
compiler/scandir.pas

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

+ 25 - 6
compiler/scanner.pas

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

+ 2 - 0
compiler/script.pas

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

+ 6 - 5
compiler/sparc/cgcpu.pas

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

+ 12 - 0
compiler/symdef.pas

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

+ 5 - 1
compiler/symtable.pas

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

+ 4 - 1
compiler/systems/t_bsd.pas

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

+ 3 - 0
compiler/systems/t_win.pas

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

+ 2 - 2
compiler/wpobase.pas

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

+ 7 - 0
compiler/x86/aasmcpu.pas

@@ -2362,6 +2362,13 @@ implementation
         if objdata.currobjsec.size<>longword(insoffset) then
         if objdata.currobjsec.size<>longword(insoffset) then
            internalerror(200130121);
            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 }
         { load data to write }
         codes:=insentry^.code;
         codes:=insentry^.code;
 {$ifdef x86_64}
 {$ifdef x86_64}

+ 9 - 0
compiler/x86/cgx86.pas

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

+ 8 - 0
compiler/x86/nx86add.pas

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

+ 3 - 1
compiler/x86/nx86mem.pas

@@ -102,7 +102,9 @@ implementation
          else if location.reference.base=NR_NO then
          else if location.reference.base=NR_NO then
           begin
           begin
             if (location.reference.scalefactor > 1) then
             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
             case location.reference.scalefactor of
              0,1 : hreg:=location.reference.index;
              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);
              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}
 {$endif i8086}
 
 
        begin
        begin
+         ranges:=false;
+         numparts:=0;
+         fillchar(setparts,sizeof(setparts),0);
+
          { We check first if we can generate jumps, this can be done
          { We check first if we can generate jumps, this can be done
            because the resultdef is already set in firstpass }
            because the resultdef is already set in firstpass }
 
 

+ 1 - 0
compiler/x86/rax86.pas

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

+ 3 - 0
compiler/x86_64/cpupara.pas

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

+ 3 - 0
compiler/x86_64/nx64add.pas

@@ -74,6 +74,9 @@ interface
         cgsize:TCgSize;
         cgsize:TCgSize;
         opsize:topsize;
         opsize:topsize;
       begin
       begin
+        reference_reset(ref,0);
+        reg:=NR_NO;
+
         cgsize:=def_cgsize(resultdef);
         cgsize:=def_cgsize(resultdef);
         opsize:=TCGSize2OpSize[cgsize];
         opsize:=TCGSize2OpSize[cgsize];
         case cgsize of
         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);
     location_reset(location,LOC_VOID,OS_NO);
 
 
     oldflowcontrol:=flowcontrol;
     oldflowcontrol:=flowcontrol;
+    exceptflowcontrol:=[];
+    continueexceptlabel:=nil;
+    breakexceptlabel:=nil;
+
     flowcontrol:=flowcontrol*[fc_unwind]+[fc_inflowcontrol];
     flowcontrol:=flowcontrol*[fc_unwind]+[fc_inflowcontrol];
     { this can be called recursivly }
     { this can be called recursivly }
     oldBreakLabel:=nil;
     oldBreakLabel:=nil;