瀏覽代碼

* secondin bugfix (m68k and i386)
* overflow checking bugfix (m68k and i386) -- pretty useless in
secondadd, since everything is done using 32-bit
* loading pointer to routines hopefully fixed (m68k)
* flags problem with calls to RTL internal routines fixed (still strcmp
to fix) (m68k)
* #ELSE was still incorrect (didn't take care of the previous level)
* problem with filenames in the command line solved
* problem with mangledname solved
* linking name problem solved (was case insensitive)
* double id problem and potential crash solved
* stop after first error
* and=>test problem removed
* correct read for all float types
* 2 sigsegv fixes and a cosmetic fix for Internal Error
* push/pop is now correct optimized (=> mov (%esp),reg)

florian 27 年之前
父節點
當前提交
2d790e0158
共有 14 個文件被更改,包括 697 次插入307 次删除
  1. 108 24
      compiler/aopt386.pas
  2. 53 6
      compiler/cg68k.pas
  3. 62 21
      compiler/cg68k2.pas
  4. 29 5
      compiler/cga68k.pas
  5. 55 18
      compiler/cgi386.pas
  6. 35 3
      compiler/cgi386ad.inc
  7. 1 0
      compiler/optione.msg
  8. 165 162
      compiler/optmsg.inc
  9. 26 3
      compiler/pass_1.pas
  10. 63 45
      compiler/pstatmnt.pas
  11. 30 5
      compiler/scanner.pas
  12. 27 2
      compiler/types.pas
  13. 21 9
      compiler/verb_def.pas
  14. 22 4
      compiler/verbose.pas

+ 108 - 24
compiler/aopt386.pas

@@ -322,13 +322,15 @@ Var LoLab, HiLab, LabDif: Longint;
                                hp1 := Pai(p^.next);
                                AsmL^.Remove(hp1);
                                Dispose(hp1, Done)
-                             End
+                             End;
+                         {
                          Else
                            If (Pai386(p)^.op2t = top_reg) And
                               Assigned(p^.next) And
                               (Pai(p^.next)^.typ = ait_labeled_instruction)
                              Then Pai386(p)^._operator := A_TEST;
-{change "and x, reg; jxx" to "test x, reg}
+                         change "and x, reg; jxx" to "test x, reg
+                         }
                        End;
                      A_CMP:
                        Begin
@@ -763,24 +765,73 @@ Var LoLab, HiLab, LabDif: Longint;
                                If (Pai386(p^.next)^.op1t = Pai386(p)^.op2t) and
                                   (Pai386(p^.next)^.op2t = Pai386(p)^.op1t) Then
                                 Begin
-                                  If (Pai386(p^.next)^.op1t = top_ref) Then
-                                   TmpBool1 := RefsEqual(TReference(Pai386(p^.next)^.op1^), TReference(Pai386(p)^.op2^))
+                                  If (Pai386(p^.next)^.op2t = top_ref) Then
+                                   TmpBool1 := RefsEqual(TReference(Pai386(p^.next)^.op2^), TReference(Pai386(p)^.op1^))
                                   Else
-                                   TmpBool1 := Pai386(p^.next)^.op1 = Pai386(p)^.op2;
-                                  If TmpBool1 Then
-                                   Begin
-                                     If (Pai386(p^.next)^.op2t = top_ref) Then
-                                      TmpBool1 := RefsEqual(TReference(Pai386(p^.next)^.op2^),
-                                       TReference(Pai386(p)^.op1^))
-                                     Else
-                                      TmpBool1 := (Pai386(p^.next)^.op2 = Pai386(p)^.op1);
-                                     If TmpBool1 Then
+                                   TmpBool1 := Pai386(p^.next)^.op2 = Pai386(p)^.op1;
+                                  If TmpBool1
+                                    Then
                                       Begin
-                                        hp1 := pai(p^.next);
-                                        AsmL^.remove(hp1);
-                                        dispose(hp1,done);
-                                      End;
-                                   End;
+                                        If (Pai386(p^.next)^.op1t = top_ref)
+                                          Then
+                                            TmpBool1 := RefsEqual(TReference(Pai386(p^.next)^.op1^),
+                                                                  TReference(Pai386(p)^.op2^))
+                                          Else TmpBool1 := (Pai386(p^.next)^.op1 = Pai386(p)^.op2);
+                                        If TmpBool1 Then
+                                          Begin
+                                            hp1 := pai(p^.next);
+                                            AsmL^.remove(hp1);
+                                            Dispose(hp1,done);
+                                          End;
+                                      End
+                                    Else
+                                                        Begin
+                                                          hp1 := pai(p^.next^.next);
+                                                          If (Pai386(p)^.op1t = top_ref) And
+                                                             (Pai386(p)^.op2t = top_reg) And
+                                                             (Pai386(p^.next)^.op1t = top_reg) And
+                                                             (Pai386(p^.next)^.op1 = Pai386(p)^.op2) And
+                                                             (Pai386(p^.next)^.op2t = top_ref) And
+                                                             Assigned(hp1) And
+                                                             (Pai(hp1)^.typ = ait_instruction) And
+                                                             (Pai386(hp1)^._operator = A_MOV) And
+                                                             (Pai386(hp1)^.op2t = top_reg) And
+                                                             (Pai386(hp1)^.op1t = top_ref) And
+                                                             RefsEqual(TReference(Pai386(hp1)^.op1^),
+                                                                       TReference(Pai386(p^.next)^.op2^))
+                                                            Then
+                                                       {   mov mem1, reg1
+                                                           mov reg1, mem2
+                                                           mov mem2, reg2
+                                                        to:
+                                                           mov mem1, reg2
+                                                           mov reg2, mem2}
+                                                              If (TRegister(Pai386(p)^.op2) <> R_ESI)
+                                                                Then
+                                                                  Begin
+                                                                    Pai386(p)^.op2 := Pai386(hp1)^.op2;
+                                                                    Pai386(p^.next)^.op1 := Pai386(hp1)^.op2;
+                                                                    AsmL^.Remove(hp1);
+                                                                    Dispose(hp1,Done);
+                                                                  End
+                                                                Else
+                                                       {   mov mem1, esi
+                                                           mov esi, mem2
+                                                           mov mem2, reg2
+                                                        to:
+                                                           mov mem1, esi
+                                                           mov mem1, reg2
+                                                           mov esi, mem2}
+                                                                  Begin
+                                                                    Pai386(p^.next)^.opxt := top_ref + top_reg shl 4;
+                                                                    Pai386(p^.next)^.op1 := Pai386(p)^.op2;
+                                                                    TReference(Pai386(p^.next)^.op1^) := TReference(Pai386(p)^.op1^);
+                                                                    Pai386(p^.next)^.op2 := Pai386(hp1)^.op2;
+                                                                    Pai386(hp1)^.opxt := top_reg + top_ref shl 4;
+                                                                    Pai386(hp1)^.op2 := Pai386(hp1)^.op1;
+                                                                    Pai386(hp1)^.op1 := Pointer(R_ESI)
+                                                                  End;
+                                                        End;
                                 End
                                Else
 (*                               {   movl [mem1],reg1
@@ -819,7 +870,7 @@ Var LoLab, HiLab, LabDif: Longint;
                                     Pai386(p^.next)^.opxt:=Top_reg+Top_ref shl 4;
                                     Pai386(p)^.op2:=Pai386(p^.next)^.op1;
                                     Pai386(p)^.opxt:=Top_const+(top_reg shl 4);
-                                  End;
+                                  End
                              End;
                            {changes "mov $0, %reg" into "xor %reg, %reg"}
                            If (Pai386(p)^.op1t = Top_Const) And
@@ -1033,12 +1084,13 @@ Var LoLab, HiLab, LabDif: Longint;
                                                 End;
                                         End;
                        End;
-                     {
                      A_POP:
                        Begin
-                         if (assigned(p^.next)) and
+                         if (Pai386(p)^.op1t = top_reg) And
+                            (assigned(p^.next)) and
                             (pai(p^.next)^.typ=ait_instruction) and
                             (Pai386(p^.next)^._operator=A_PUSH) and
+                            (Pai386(p^.next)^.op1t = top_reg) And
                             (Pai386(p^.next)^.op1=Pai386(p)^.op1) then
                               begin
                                 hp2:=pai(p^.next^.next);
@@ -1049,9 +1101,23 @@ Var LoLab, HiLab, LabDif: Longint;
                                 dispose(hp1,done);
                                 p:=hp2;
                                 continue;
+{                                Pai386(p)^._operator := A_MOV;
+                                Pai386(p)^.op2 := Pai386(p)^.op1;
+                                Pai386(p)^.opxt := top_ref + top_reg shl 4;
+                                New(TmpRef);
+                                TmpRef^.segment := R_DEFAULT_SEG;
+                                TmpRef^.base := R_ESP;
+                                TmpRef^.index := R_NO;
+                                TmpRef^.scalefactor := 1;
+                                TmpRef^.symbol := nil;
+                                TmpRef^.isintvalue := false;
+                                TmpRef^.offset := 0;
+                                Pai386(p)^.op1 := Pointer(TmpRef);
+                                hp1 := Pai(p^.next);
+                                AsmL^.Remove(hp1);
+                                Dispose(hp1, Done)}
                               end;
                        end;
-                     }
                      A_PUSH:
                        Begin
                          If (Pai386(p)^.size = S_W) And
@@ -1412,8 +1478,26 @@ end;
 End.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:12  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:53  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:12  root
+  * Restored version
 
   Revision 1.29  1998/03/24 21:48:29  florian
     * just a couple of fixes applied:

+ 53 - 6
compiler/cg68k.pas

@@ -738,7 +738,7 @@ implementation
                                  exprasmlist^.concat(new(pai68k,op_reg(A_FNEG,S_X,p^.location.fpureg)));
                            end;
          end;
-         emitoverflowcheck;
+{         emitoverflowcheck;}
       end;
 
     { use of A6 is required only temp (ok) }
@@ -907,7 +907,7 @@ implementation
          oflabel:=falselabel;
          getlabel(truelabel);
          getlabel(falselabel);
-         withresult:=not(aktexprlevel<4);
+         withresult:=false;
          { calculate left sides }
          secondpass(p^.left);
          case p^.left^.location.loc of
@@ -3113,7 +3113,20 @@ implementation
                                 end
                  else
                     begin
-                       exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,newreference(p^.right^.location.reference))));
+                      if assigned(p^.right^.location.reference.symbol) then
+                      { Here we have a symbolic name to the routine, so solve  }
+                      { problem by loading the address first, and then emitting }
+                      { the call.                                              }
+                       begin
+                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+                           newreference(p^.right^.location.reference),R_A1)));
+                         new(ref);
+                         reset_reference(ref^);
+                         ref^.base := R_A1;
+                         exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,newreference(ref^))));
+                       end
+                       else
+                         exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,newreference(p^.right^.location.reference))));
                        del_reference(p^.right^.location.reference);
                     end;
               end;
@@ -3833,7 +3846,7 @@ implementation
                     secondpass(p^.left);
                     exprasmlist^.concat(new(pai68k,op_const_ref(in2instr[p^.inlinenumber],
                      in2size[p^.inlinenumber],1,newreference(p^.left^.location.reference))));
-                    emitoverflowcheck;
+                     emitoverflowcheck(p^.left);
                 end;
             in_pred_x,
             in_succ_x:
@@ -4081,6 +4094,7 @@ implementation
          i,smallsetvalue : longint;
          hp : ptree;
          href,sref : treference;
+         hl1,hl2: plabel;
 
       begin
          { this should be reimplemented for smallsets }
@@ -4139,6 +4153,21 @@ implementation
                    emitpushreferenceaddr(sref);
                    { register is save in subroutine }
                    emitcall('SET_SET_BYTE',true);
+                   { here we must set the flags manually  }
+                   { on returne from the routine, because }
+                   { falgs are corrupt when restoring the }
+                   { stack                                }
+                   exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_B,R_D0)));
+                   getlabel(hl1);
+                   emitl(A_BEQ,hl1);
+                   exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_B,
+                       $fe,R_CCR)));
+                   getlabel(hl2);
+                   emitl(A_BRA,hl2);
+                   emitl(A_LABEL,hl1);
+                   exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,
+                       $01,R_CCR)));
+                   emitl(A_LABEL,hl2);
                    hp:=hp^.right;
                 end;
               p^.location.reference:=sref;
@@ -5067,8 +5096,26 @@ end.
 
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:16  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:54  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:16  root
+  * Restored version
 
   Revision 1.51  1998/03/22 12:45:37  florian
     * changes of Carl-Eric to m68k target commit:

+ 62 - 21
compiler/cg68k2.pas

@@ -597,7 +597,7 @@ Implementation
                    { only in case of overflow operations }
                    { produce overflow code }
                    if mboverflow then
-                     emitoverflowcheck;
+                     emitoverflowcheck(p);
                end
               else if ((p^.left^.resulttype^.deftype=orddef) and
                  (porddef(p^.left^.resulttype)^.typ=uchar)) then
@@ -1432,6 +1432,7 @@ Implementation
          href,href2:Treference;
          l,l2 : plabel;
        hl,hl1 : plabel;
+       hl2, hl3: plabel;
 
 
             function analizeset(Aset:Pconstset):boolean;
@@ -1636,34 +1637,41 @@ Implementation
                                         getlabel(l2);
                                         href.symbol:=stringdup(lab2str(l2));
                                         if setparts[i].start=setparts[i].stop-1 then
-                                            begin
-                                       case p^.left^.location.loc of
+                                        begin
+
+                                          case p^.left^.location.loc of
                                            LOC_REGISTER,
                                            LOC_CREGISTER :
                                                   exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_B,
                                                     setparts[i].start,p^.left^.location.register)));
-                                    else
+                                          else
                                                   exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
                                                     setparts[i].start,newreference(p^.left^.location.reference))));
-                                    end;
-                                                {Result should be in carry flag when ranges are used.}
-                                                if ranges then
-                                                    exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
-
-                                                {If found, jump to end.}
-                                                emitl(A_BEQ,l);
-                                       case p^.left^.location.loc of
+                                          end;
+                                          {Result should be in carry flag when ranges are used.}
+                                          { Here the m68k does not affect any flag except the  }
+                                          { flag which is OR'ed                                }
+                                          if ranges then
+                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                          {If found, jump to end.}
+                                          emitl(A_BEQ,l);
+                                          case p^.left^.location.loc of
                                            LOC_REGISTER,
                                            LOC_CREGISTER :
                                                 exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_B,
                                                  setparts[i].stop,p^.left^.location.register)));
-                                    else
+                                          else
                                                 exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
                                                  setparts[i].stop,newreference(p^.left^.location.reference))));
-                                    end;
-                                                {If found, jump to end.}
-                                                emitl(A_BEQ,l);
-                                            end
+                                          end;
+                                          {Result should be in carry flag when ranges are used.}
+                                          { Here the m68k does not affect any flag except the  }
+                                          { flag which is OR'ed                                }
+                                          if ranges then
+                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                          {If found, jump to end.}
+                                          emitl(A_BEQ,l);
+                                       end
                                         else
                                             begin
                                                 if setparts[i].start<>0 then
@@ -1748,8 +1756,23 @@ Implementation
                            { registers need not be save. that happens in SET_IN_BYTE }
                            emitcall('SET_IN_BYTE',true);
                      { ungetiftemp(p^.right^.location.reference); }
-                           p^.location.loc:=LOC_FLAGS;
-                           p^.location.resflags:=F_C;
+                          { here we must set the flags manually  }
+                          { on returne from the routine, because }
+                          { flags are corrupt when restoring the }
+                          { stack                                }
+                          exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_B,R_D0)));
+                          getlabel(hl2);
+                          emitl(A_BEQ,hl2);
+                          exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_B,
+                            $fe,R_CCR)));
+                          getlabel(hl3);
+                          emitl(A_BRA,hl3);
+                          emitl(A_LABEL,hl2);
+                          exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,
+                             $01,R_CCR)));
+                          emitl(A_LABEL,hl3);
+                          p^.location.loc:=LOC_FLAGS;
+                          p^.location.resflags:=F_C;
                         end;
                 end;
              end;
@@ -1898,8 +1921,26 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:13  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:54  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:13  root
+  * Restored version
 
   Revision 1.18  1998/03/10 01:17:15  peter
     * all files have the same header

+ 29 - 5
compiler/cga68k.pas

@@ -35,7 +35,7 @@ unit cga68k;
                               destreg:Tregister;delloc:boolean);
     { produces jumps to true respectively false labels using boolean expressions }
     procedure maketojumpbool(p : ptree);
-    procedure emitoverflowcheck;
+    procedure emitoverflowcheck(p: ptree);
     procedure push_int(l : longint);
     function maybe_push(needed : byte;p : ptree) : boolean;
     procedure restore(p : ptree);
@@ -350,7 +350,7 @@ unit cga68k;
           Message(sym_e_type_mismatch);
       end;
 
-    procedure emitoverflowcheck;
+    procedure emitoverflowcheck(p: ptree);
 
       var
          hl : plabel;
@@ -359,12 +359,18 @@ unit cga68k;
          if cs_check_overflow in aktswitches  then
            begin
               getlabel(hl);
-              emitl(A_BVC,hl);
+              if not ((p^.resulttype^.deftype=pointerdef) or
+                     ((p^.resulttype^.deftype=orddef) and
+                (porddef(p^.resulttype)^.typ in [u16bit,u32bit,u8bit,uchar,bool8bit]))) then
+                emitl(A_BVC,hl)
+              else
+                emitl(A_BCC,hl);
               emitcall('RE_OVERFLOW',true);
               emitl(A_LABEL,hl);
            end;
       end;
 
+
     procedure push_int(l : longint);
 
       begin
@@ -1251,8 +1257,26 @@ end;
   end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:13  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:54  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:13  root
+  * Restored version
 
   Revision 1.15  1998/03/22 12:45:38  florian
     * changes of Carl-Eric to m68k target commit:

+ 55 - 18
compiler/cgi386.pas

@@ -825,7 +825,12 @@ implementation
                  exprasmlist^.concat(new(pai386,op_none(A_FCHS,S_NO)));
               end;
          end;
-         emitoverflowcheck;
+{ Here was a problem...            }
+{ Operand to be negated always     }
+{ seems to be converted to signed  }
+{ 32-bit before doing neg!!        }
+{ So this is useless...            }
+{         emitoverflowcheck(p);}
       end;
 
     procedure secondaddr(var p : ptree);
@@ -3194,7 +3199,8 @@ implementation
                          (S_B,S_W,S_L,S_B,S_W,S_L);
                in2instr:array[in_inc_byte..in_dec_dword] of Tasmop=
                          (A_INC,A_INC,A_INC,A_DEC,A_DEC,A_DEC);
-
+               ad2instr:array[in_inc_byte..in_dec_dword] of Tasmop=
+                         (A_ADD,A_ADD,A_ADD,A_SUB,A_SUB,A_SUB);
             { tfloattype = (f32bit,s32real,s64real,s80real,s64bit); }
             float_name: array[tfloattype] of string[8]=
                 ('FIXED','SINGLE','REAL','EXTENDED','COMP','FIXED16');
@@ -3400,15 +3406,16 @@ implementation
                                 end
                               end;
                           case pararesult^.deftype of
-                                    stringdef : begin
-                                                       if doread then
-                                                         emitcall('READ_TEXT_STRING',true)
-                                                       else
-                                                         begin
-                                                            emitcall('WRITE_TEXT_STRING',true);
+                             stringdef:
+                               begin
+                                  if doread then
+                                    emitcall('READ_TEXT_STRING',true)
+                                  else
+                                    begin
+                                      emitcall('WRITE_TEXT_STRING',true);
                                       {ungetiftemp(hp^.left^.location.reference);}
-                                   end;
-                                                   end;
+                                    end;
+                               end;
                                     pointerdef : begin
                                                         if is_equal(ppointerdef(pararesult)^.definition,cchardef) then
                                                           begin
@@ -3433,12 +3440,13 @@ implementation
                                                       Message(parser_e_illegal_parameter_list);
                                                   end;
 
-                                    floatdef : begin
-                                                  if doread then
-                                                    emitcall('READ_TEXT_REAL',true)
-                                                  else
-                                                    emitcall('WRITE_TEXT_'+float_name[pfloatdef(pararesult)^.typ],true);
-                                               end;
+                             floatdef:
+                               begin
+                                  if doread then
+                                    emitcall('READ_TEXT_'+float_name[pfloatdef(pararesult)^.typ],true)
+                                  else
+                                    emitcall('WRITE_TEXT_'+float_name[pfloatdef(pararesult)^.typ],true);
+                               end;
                                     orddef : begin
                                                      case porddef(pararesult)^.typ of
                                                          u8bit : if doread then
@@ -3773,9 +3781,17 @@ implementation
             in_inc_byte..in_dec_dword:
               begin
                  secondpass(p^.left);
+                 if cs_check_overflow in aktswitches then
+                   begin
+                   { SINCE THE CARRY FLAG IS NEVER SET BY DEC/INC, we must use  }
+                   { ADD and SUB to check for overflow for unsigned operations. }
+                     exprasmlist^.concat(new(pai386,op_const_ref(ad2instr[p^.inlinenumber],
+                       in2size[p^.inlinenumber],1,newreference(p^.left^.location.reference))));
+                     emitoverflowcheck(p^.left);
+                   end
+                 else
                  exprasmlist^.concat(new(pai386,op_ref(in2instr[p^.inlinenumber],
                    in2size[p^.inlinenumber],newreference(p^.left^.location.reference))));
-                 emitoverflowcheck;
               end;
             in_assigned_x :
               begin
@@ -4332,6 +4348,9 @@ implementation
                                              exprasmlist^.concat(new(pai386,op_const_ref(A_CMP,S_B,
                                                setparts[i].stop,newreference(p^.left^.location.reference))));
                                         end;
+                                        {Result should be in carry flag when ranges are used.}
+                                        if ranges then
+                                          exprasmlist^.concat(new(pai386,op_none(A_STC,S_NO)));
                                         {If found, jump to end.}
                                         emitl(A_JE,l);
                                      end
@@ -5654,7 +5673,25 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.2  1998-03-26 11:18:30  florian
+  Revision 1.3  1998-03-28 23:09:55  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.2  1998/03/26 11:18:30  florian
     - switch -Sa removed
     - support of a:=b:=0 removed
 

+ 35 - 3
compiler/cgi386ad.inc

@@ -351,6 +351,7 @@
          power : longint;
          href : treference;
          opsize : topsize;
+         hl4: plabel;
 
          { true, if unsigned types are compared }
          unsigned : boolean;
@@ -841,7 +842,20 @@
                    { only in case of overflow operations }
                    { produce overflow code }
                    if mboverflow then
-                     emitoverflowcheck;
+                   { we must put it here directly, because sign of operation }
+                   { is in unsigned VAR!!                                    }
+                   begin
+                     if cs_check_overflow in aktswitches  then
+                     begin
+                       getlabel(hl4);
+                       if unsigned then
+                        emitl(A_JNB,hl4)
+                       else
+                        emitl(A_JNO,hl4);
+                       emitcall('RE_OVERFLOW',true);
+                       emitl(A_LABEL,hl4);
+                     end;
+                   end;
                 end
               else if ((p^.left^.resulttype^.deftype=orddef) and
                  (porddef(p^.left^.resulttype)^.typ=uchar)) then
@@ -1220,8 +1234,26 @@
 
 {
      $Log$
-     Revision 1.1  1998-03-25 11:18:12  root
-     Initial revision
+     Revision 1.2  1998-03-28 23:09:55  florian
+       * secondin bugfix (m68k and i386)
+       * overflow checking bugfix (m68k and i386) -- pretty useless in
+         secondadd, since everything is done using 32-bit
+       * loading pointer to routines hopefully fixed (m68k)
+       * flags problem with calls to RTL internal routines fixed (still strcmp
+         to fix) (m68k)
+       * #ELSE was still incorrect (didn't take care of the previous level)
+       * problem with filenames in the command line solved
+       * problem with mangledname solved
+       * linking name problem solved (was case insensitive)
+       * double id problem and potential crash solved
+       * stop after first error
+       * and=>test problem removed
+       * correct read for all float types
+       * 2 sigsegv fixes and a cosmetic fix for Internal Error
+       * push/pop is now correct optimized (=> mov (%esp),reg)
+
+     Revision 1.1.1.1  1998/03/25 11:18:12  root
+     * Restored version
 
      Revision 1.15  1998/03/10 23:48:36  florian
        * a couple of bug fixes to get the compiler with -OGaxz compiler, sadly

+ 1 - 0
compiler/optione.msg

@@ -81,6 +81,7 @@ Report bugs,suggestions etc to:
 **1S_syntax options
 **2S2_switch some Delphi 2 extension on
 **2Sc_supports operators like C (*=,+=,/= and -=)
+**2Se_compiler stops after the first error
 **2Sg_allows LABEL and GOTO
 **2Si_support C++ stlyed INLINE
 **2Sm_support macros like C (global)

+ 165 - 162
compiler/optmsg.inc

@@ -1,4 +1,4 @@
-const optiontxt : array[1..04551] of char=(
+const optiontxt : array[1..04594] of char=(
   ' ','[','o','p','t','i','o','n','s',']',' ','<','i','n','p',
   'u','t','f','i','l','e','>',' ','[','o','p','t','i','o','n',
   's',']',#000,'O','n','l','y',' ','o','n','e',' ','s','o','u',
@@ -142,164 +142,167 @@ const optiontxt : array[1..04551] of char=(
   ' ','o','n',#000,'*','*','2','S','c','_','s','u','p','p','o',
   'r','t','s',' ','o','p','e','r','a','t','o','r','s',' ','l',
   'i','k','e',' ','C',' ','(','*','=',',','+','=',',','/','=',
-  ' ','a','n','d',' ','-','=',')',#000,'*','*','2','S','g','_',
-  'a','l','l','o','w','s',' ','L','A','B','E','L',' ','a','n',
-  'd',' ','G','O','T','O',#000,'*','*','2','S','i','_','s','u',
-  'p','p','o','r','t',' ','C','+','+',' ','s','t','l','y','e',
-  'd',' ','I','N','L','I','N','E',#000,'*','*','2','S','m','_',
-  's','u','p','p','o','r','t',' ','m','a','c','r','o','s',' ',
-  'l','i','k','e',' ','C',' ','(','g','l','o','b','a','l',')',
-  #000,'*','*','2','S','o','_','t','r','i','e','s',' ','t','o',
-  ' ','b','e',' ','T','P','/','B','P',' ','7','.','0',' ','c',
-  'o','m','p','a','t','i','b','l','e',#000,'*','*','2','S','s',
-  '_','c','o','n','s','t','r','u','c','t','o','r',' ','n','a',
-  'm','e',' ','m','u','s','t',' ','b','e',' ','i','n','i','t',
-  ' ','(','d','e','s','t','r','u','c','t','o','r',' ','m','u',
-  's','t',' ','b','e',' ','d','o','n','e',')',#000,'*','*','2',
-  'S','t','_','a','l','l','o','w','s',' ','s','t','a','t','i',
-  'c',' ','k','e','y','w','o','r','d',' ','i','n',' ','o','b',
-  'j','e','c','t','s',#000,'*','*','1','s','_','d','o','n',#039,
-  't',' ','c','a','l','l',' ','a','s','s','e','m','b','l','e',
-  'r',' ','a','n','d',' ','l','i','n','k','e','r',' ','(','o',
-  'n','l','y',' ','w','i','t','h',' ','-','a',')',#000,'*','*',
-  '1','T','<','x','>','_','T','a','r','g','e','t',' ','o','p',
-  'e','r','a','t','i','n','g',' ','s','y','s','t','e','m',#000,
-  '3','*','2','T','D','O','S','_','D','O','S',' ','e','x','t',
-  'e','n','d','e','r',' ','b','y',' ','D','J',' ','D','e','l',
-  'o','r','i','e',#000,'3','*','2','T','O','S','2','_','O','S',
-  '/','2',' ','2','.','x',#000,'3','*','2','T','L','I','N','U',
-  'X','_','L','i','n','u','x',#000,'3','*','2','T','W','i','n',
-  '3','2','_','W','i','n','d','o','w','s',' ','3','2',' ','B',
-  'i','t',#000,'3','*','2','T','G','O','3','2','V','2','_','v',
-  'e','r','s','i','o','n',' ','2',' ','o','f',' ','D','J',' ',
-  'D','e','l','o','r','i','e',' ','D','O','S',' ','e','x','t',
-  'e','n','d','e','r',#000,'6','*','2','T','A','M','I','G','A',
-  '_','C','o','m','m','o','d','o','r','e',' ','A','m','i','g',
-  'a',#000,'6','*','2','T','A','T','A','R','I','_','A','t','a',
-  'r','i',' ','S','T','/','S','T','e','/','T','T',#000,'6','*',
-  '2','T','M','A','C','O','S','_','M','a','c','i','n','t','o',
-  's','h',' ','m','6','8','k',#000,'6','*','2','T','L','I','N',
-  'U','X','_','L','i','n','u','x','-','6','8','k',#000,'*','*',
-  '1','u','<','x','>','_','u','n','d','e','f','i','n','e','s',
-  ' ','t','h','e',' ','s','y','m','b','o','l',' ','<','x','>',
-  #000,'*','*','1','U','_','u','n','i','t',' ','o','p','t','i',
-  'o','n','s',#000,'*','*','2','U','l','s','_','m','a','k','e',
-  ' ','s','t','a','t','i','c',' ','l','i','b','r','a','r','y',
-  ' ','f','r','o','m',' ','u','n','i','t',#000,'*','*','2','U',
-  'l','d','_','m','a','k','e',' ','d','y','n','a','m','i','c',
-  ' ','l','i','b','r','a','r','y',' ','f','r','o','m',' ','u',
-  'n','i','t',#000,'*','*','2','U','n','_','d','o','n',#039,'t',
-  ' ','c','h','e','c','k',' ','t','h','e',' ','u','n','i','t',
-  ' ','n','a','m','e',#000,'*','*','2','U','p','<','x','>','_',
-  's','a','m','e',' ','a','s',' ','-','F','u','<','x','>',#000,
-  '*','*','2','U','s','_','c','o','m','p','i','l','e',' ','a',
-  ' ','s','y','s','t','e','m',' ','u','n','i','t',#000,'*','*',
-  '1','v','<','x','>','_','B','e',' ','v','e','r','b','o','s',
-  'e','.',' ','<','x','>',' ','i','s',' ','a',' ','c','o','m',
-  'b','i','n','a','t','i','o','n',' ','o','f',' ','t','h','e',
-  ' ','f','o','l','l','o','w','i','n','g',' ','l','e','t','t',
-  'e','r','s',' ',':',#000,'*','*','2','*','_','e',' ',':',' ',
-  'S','h','o','w',' ','e','r','r','o','r','s',' ','(','d','e',
-  'f','a','u','l','t',')',' ',' ',' ',' ',' ',' ',' ','d',' ',
-  ':',' ','S','h','o','w',' ','d','e','b','u','g',' ','i','n',
-  'f','o',#000,'*','*','2','*','_','w',' ',':',' ','S','h','o',
-  'w',' ','w','a','r','n','i','n','g','s',' ',' ',' ',' ',' ',
-  ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','u',' ',':',' ','S',
-  'h','o','w',' ','u','s','e','d',' ','f','i','l','e','s',#000,
-  '*','*','2','*','_','n',' ',':',' ','S','h','o','w',' ','n',
-  'o','t','e','s',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
-  ' ',' ',' ',' ',' ',' ',' ','t',' ',':',' ','S','h','o','w',
-  ' ','t','r','i','e','d',' ','f','i','l','e','s',#000,'*','*',
-  '2','*','_','h',' ',':',' ','S','h','o','w',' ','h','i','n',
-  't','s',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
-  ' ',' ',' ',' ',' ','m',' ',':',' ','S','h','o','w',' ','d',
-  'e','f','i','n','e','d',' ','m','a','c','r','o','s',#000,'*',
-  '*','2','*','_','i',' ',':',' ','S','h','o','w',' ','g','e',
-  'n','e','r','a','l',' ','i','n','f','o',' ',' ',' ',' ',' ',
-  ' ',' ',' ',' ',' ',' ','p',' ',':',' ','S','h','o','w',' ',
-  'c','o','m','p','i','l','e','d',' ','p','r','o','c','e','d',
-  'u','r','e','s',#000,'*','*','2','*','_','l',' ',':',' ','S',
-  'h','o','w',' ','l','i','n','e','n','u','m','b','e','r','s',
-  ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','c',' ',':',
-  ' ','S','h','o','w',' ','c','o','n','d','i','t','i','o','n',
-  'a','l','s',#000,'*','*','2','*','_','a',' ',':',' ','S','h',
-  'o','w',' ','e','v','e','r','y','t','h','i','n','g',' ',' ',
-  ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0',' ',':',' ',
-  'S','h','o','w',' ','n','o','t','h','i','n','g',' ','(','e',
-  'x','c','e','p','t',' ','e','r','r','o','r','s',')',#000,'*',
-  '*','1','X','_','e','x','e','c','u','t','a','b','l','e',' ',
-  'o','p','t','i','o','n','s',#000,'*','L','2','X','c','_','l',
-  'i','n','k',' ','w','i','t','h',' ','t','h','e',' ','c',' ',
-  'l','i','b','r','a','r','y',#000,'*','*','2','X','s','_','s',
-  't','r','i','p',' ','a','l','l',' ','s','y','m','b','o','l',
-  's',' ','f','r','o','m',' ','e','x','e','c','u','t','a','b',
-  'l','e',#000,'*','*','0','*','_','P','r','o','c','e','s','s',
-  'o','r',' ','s','p','e','c','i','f','i','c',' ','o','p','t',
-  'i','o','n','s',':',#000,'3','*','1','A','_','o','u','t','p',
-  'u','t',' ','f','o','r','m','a','t',#000,'3','*','2','A','a',
-  't','t','_','A','T','&','T',' ','a','s','s','e','m','b','l',
-  'e','r',#000,'3','*','2','A','o','_','c','o','f','f',' ','f',
-  'i','l','e',' ','u','s','i','n','g',' ','G','N','U',' ','A',
-  'S',#000,'3','*','2','A','o','b','j','_','O','M','F',' ','f',
-  'i','l','e',' ','u','s','i','n','g',' ','N','A','S','M',#000,
-  '3','*','2','A','n','a','s','m','_','c','o','f','f',' ','f',
-  'i','l','e',' ','u','s','i','n','g',' ','N','A','S','M',#000,
-  '3','*','2','A','m','a','s','m','_','a','s','s','e','m','b',
-  'l','e','r',' ','f','o','r',' ','t','h','e',' ','M','i','c',
-  'r','o','s','o','f','t','/','B','o','r','l','a','n','d','/',
-  'W','a','t','c','o','m',' ','a','s','s','e','m','b','l','e',
-  'r',#000,'3','*','1','R','_','a','s','s','e','m','b','l','e',
-  'r',' ','r','e','a','d','i','n','g',' ','s','t','y','l','e',
-  #000,'3','*','2','R','a','t','t','_','r','e','a','d',' ','A',
-  'T','&','T',' ','s','t','y','l','e',' ','a','s','s','e','m',
-  'b','l','e','r',#000,'3','*','2','R','i','n','t','e','l','_',
-  'r','e','a','d',' ','I','n','t','e','l',' ','s','t','y','l',
-  'e',' ','a','s','s','e','m','b','l','e','r',#000,'3','*','2',
-  'R','d','i','r','e','c','t','_','c','o','p','y',' ','a','s',
-  's','e','m','b','l','e','r',' ','t','e','x','t',' ','d','i',
-  'r','e','c','t','l','y',' ','t','o',' ','a','s','s','e','m',
-  'b','l','e','r',' ','f','i','l','e',#000,'3','*','1','O','_',
-  'o','p','t','i','m','i','z','a','t','i','o','n','s',#000,'3',
-  '*','2','O','a','_','s','i','m','p','l','e',' ','o','p','t',
-  'i','m','i','z','a','t','i','o','n','s',#000,'3','*','2','O',
-  'g','_','o','p','t','i','m','i','z','e',' ','f','o','r',' ',
-  's','i','z','e',#000,'3','*','2','O','G','_','o','p','t','i',
-  'm','i','z','e',' ','f','o','r',' ','t','i','m','e',#000,'3',
-  '*','2','O','x','_','o','p','t','i','m','i','z','e',' ','m',
-  'a','x','i','m','u','m',#000,'3','*','2','O','z','_','u','n',
-  'c','e','r','t','a','i','n',' ','o','p','t','i','m','i','z',
-  'e','s',' ','(','s','e','e',' ','d','o','c','s',')',#000,'3',
-  '*','2','O','2','_','o','p','t','i','m','i','z','e',' ','f',
-  'o','r',' ','P','e','n','t','i','u','m',' ','I','I',' ','(',
-  't','m',')',#000,'3','*','2','O','3','_','o','p','t','i','m',
-  'i','z','e',' ','f','o','r',' ','i','3','8','6',#000,'3','*',
-  '2','O','4','_','o','p','t','i','m','i','z','e',' ','f','o',
-  'r',' ','i','4','8','6',#000,'3','*','2','O','5','_','o','p',
-  't','i','m','i','z','e',' ','f','o','r',' ','P','e','n','t',
-  'i','u','m',' ','(','t','m',')',#000,'3','*','2','O','6','_',
-  'o','p','t','i','m','i','z','a','t','i','o','n','s',' ','f',
-  'o','r',' ','P','e','n','t','i','u','m','P','r','o',' ','(',
-  't','m',')',#000,'6','*','1','A','_','o','u','t','p','u','t',
-  ' ','f','o','r','m','a','t',#000,'6','*','2','A','g','a','s',
-  '_','G','N','U',' ','M','o','t','o','r','o','l','a',' ','a',
-  's','s','e','m','b','l','e','r',#000,'6','*','2','A','o','_',
-  'U','N','I','X',' ','o','-','f','i','l','e',#000,'6','*','2',
-  'A','m','_','S','t','a','n','d','a','r','d',' ','M','o','t',
-  'o','r','o','l','a',' ','a','s','s','e','m','b','l','e','r',
-  #000,'6','*','2','A','i','_','M','I','T',' ','S','y','n','t',
-  'a','x',' ','(','o','l','d',' ','G','A','S',')',#000,'6','*',
-  '1','O','_','o','p','t','i','m','i','z','a','t','i','o','n',
-  's',#000,'6','*','2','O','a','_','s','i','m','p','l','e',' ',
-  'o','p','t','i','m','i','z','a','t','i','o','n','s',#000,'6',
-  '*','2','O','g','_','o','p','t','i','m','i','z','e',' ','f',
-  'o','r',' ','s','i','z','e',#000,'6','*','2','O','G','_','o',
-  'p','t','i','m','i','z','e',' ','f','o','r',' ','t','i','m',
-  'e',#000,'6','*','2','O','x','_','o','p','t','i','m','i','z',
-  'e',' ','m','a','x','i','m','u','m',#000,'6','*','2','O','2',
-  '_','t','a','r','g','e','t',' ','i','s',' ','a',' ','M','C',
-  '6','8','0','2','0','+',' ','p','r','o','c','e','s','s','o',
-  'r',#000,'*','*','1','*','_',#000,'*','*','1','?','_','s','h',
-  'o','w','s',' ','t','h','i','s',' ','h','e','l','p',#000,'*',
-  '*','1','h','_','s','h','o','w','s',' ','t','h','i','s',' ',
-  'h','e','l','p',' ','w','i','t','h','o','u','t',' ','w','a',
-  'i','t','i','n','g',#000);
+  ' ','a','n','d',' ','-','=',')',#000,'*','*','2','S','e','_',
+  'c','o','m','p','i','l','e','r',' ','s','t','o','p','s',' ',
+  'a','f','t','e','r',' ','t','h','e',' ','f','i','r','s','t',
+  ' ','e','r','r','o','r',#000,'*','*','2','S','g','_','a','l',
+  'l','o','w','s',' ','L','A','B','E','L',' ','a','n','d',' ',
+  'G','O','T','O',#000,'*','*','2','S','i','_','s','u','p','p',
+  'o','r','t',' ','C','+','+',' ','s','t','l','y','e','d',' ',
+  'I','N','L','I','N','E',#000,'*','*','2','S','m','_','s','u',
+  'p','p','o','r','t',' ','m','a','c','r','o','s',' ','l','i',
+  'k','e',' ','C',' ','(','g','l','o','b','a','l',')',#000,'*',
+  '*','2','S','o','_','t','r','i','e','s',' ','t','o',' ','b',
+  'e',' ','T','P','/','B','P',' ','7','.','0',' ','c','o','m',
+  'p','a','t','i','b','l','e',#000,'*','*','2','S','s','_','c',
+  'o','n','s','t','r','u','c','t','o','r',' ','n','a','m','e',
+  ' ','m','u','s','t',' ','b','e',' ','i','n','i','t',' ','(',
+  'd','e','s','t','r','u','c','t','o','r',' ','m','u','s','t',
+  ' ','b','e',' ','d','o','n','e',')',#000,'*','*','2','S','t',
+  '_','a','l','l','o','w','s',' ','s','t','a','t','i','c',' ',
+  'k','e','y','w','o','r','d',' ','i','n',' ','o','b','j','e',
+  'c','t','s',#000,'*','*','1','s','_','d','o','n',#039,'t',' ',
+  'c','a','l','l',' ','a','s','s','e','m','b','l','e','r',' ',
+  'a','n','d',' ','l','i','n','k','e','r',' ','(','o','n','l',
+  'y',' ','w','i','t','h',' ','-','a',')',#000,'*','*','1','T',
+  '<','x','>','_','T','a','r','g','e','t',' ','o','p','e','r',
+  'a','t','i','n','g',' ','s','y','s','t','e','m',#000,'3','*',
+  '2','T','D','O','S','_','D','O','S',' ','e','x','t','e','n',
+  'd','e','r',' ','b','y',' ','D','J',' ','D','e','l','o','r',
+  'i','e',#000,'3','*','2','T','O','S','2','_','O','S','/','2',
+  ' ','2','.','x',#000,'3','*','2','T','L','I','N','U','X','_',
+  'L','i','n','u','x',#000,'3','*','2','T','W','i','n','3','2',
+  '_','W','i','n','d','o','w','s',' ','3','2',' ','B','i','t',
+  #000,'3','*','2','T','G','O','3','2','V','2','_','v','e','r',
+  's','i','o','n',' ','2',' ','o','f',' ','D','J',' ','D','e',
+  'l','o','r','i','e',' ','D','O','S',' ','e','x','t','e','n',
+  'd','e','r',#000,'6','*','2','T','A','M','I','G','A','_','C',
+  'o','m','m','o','d','o','r','e',' ','A','m','i','g','a',#000,
+  '6','*','2','T','A','T','A','R','I','_','A','t','a','r','i',
+  ' ','S','T','/','S','T','e','/','T','T',#000,'6','*','2','T',
+  'M','A','C','O','S','_','M','a','c','i','n','t','o','s','h',
+  ' ','m','6','8','k',#000,'6','*','2','T','L','I','N','U','X',
+  '_','L','i','n','u','x','-','6','8','k',#000,'*','*','1','u',
+  '<','x','>','_','u','n','d','e','f','i','n','e','s',' ','t',
+  'h','e',' ','s','y','m','b','o','l',' ','<','x','>',#000,'*',
+  '*','1','U','_','u','n','i','t',' ','o','p','t','i','o','n',
+  's',#000,'*','*','2','U','l','s','_','m','a','k','e',' ','s',
+  't','a','t','i','c',' ','l','i','b','r','a','r','y',' ','f',
+  'r','o','m',' ','u','n','i','t',#000,'*','*','2','U','l','d',
+  '_','m','a','k','e',' ','d','y','n','a','m','i','c',' ','l',
+  'i','b','r','a','r','y',' ','f','r','o','m',' ','u','n','i',
+  't',#000,'*','*','2','U','n','_','d','o','n',#039,'t',' ','c',
+  'h','e','c','k',' ','t','h','e',' ','u','n','i','t',' ','n',
+  'a','m','e',#000,'*','*','2','U','p','<','x','>','_','s','a',
+  'm','e',' ','a','s',' ','-','F','u','<','x','>',#000,'*','*',
+  '2','U','s','_','c','o','m','p','i','l','e',' ','a',' ','s',
+  'y','s','t','e','m',' ','u','n','i','t',#000,'*','*','1','v',
+  '<','x','>','_','B','e',' ','v','e','r','b','o','s','e','.',
+  ' ','<','x','>',' ','i','s',' ','a',' ','c','o','m','b','i',
+  'n','a','t','i','o','n',' ','o','f',' ','t','h','e',' ','f',
+  'o','l','l','o','w','i','n','g',' ','l','e','t','t','e','r',
+  's',' ',':',#000,'*','*','2','*','_','e',' ',':',' ','S','h',
+  'o','w',' ','e','r','r','o','r','s',' ','(','d','e','f','a',
+  'u','l','t',')',' ',' ',' ',' ',' ',' ',' ','d',' ',':',' ',
+  'S','h','o','w',' ','d','e','b','u','g',' ','i','n','f','o',
+  #000,'*','*','2','*','_','w',' ',':',' ','S','h','o','w',' ',
+  'w','a','r','n','i','n','g','s',' ',' ',' ',' ',' ',' ',' ',
+  ' ',' ',' ',' ',' ',' ',' ',' ','u',' ',':',' ','S','h','o',
+  'w',' ','u','s','e','d',' ','f','i','l','e','s',#000,'*','*',
+  '2','*','_','n',' ',':',' ','S','h','o','w',' ','n','o','t',
+  'e','s',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
+  ' ',' ',' ',' ',' ','t',' ',':',' ','S','h','o','w',' ','t',
+  'r','i','e','d',' ','f','i','l','e','s',#000,'*','*','2','*',
+  '_','h',' ',':',' ','S','h','o','w',' ','h','i','n','t','s',
+  ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
+  ' ',' ',' ','m',' ',':',' ','S','h','o','w',' ','d','e','f',
+  'i','n','e','d',' ','m','a','c','r','o','s',#000,'*','*','2',
+  '*','_','i',' ',':',' ','S','h','o','w',' ','g','e','n','e',
+  'r','a','l',' ','i','n','f','o',' ',' ',' ',' ',' ',' ',' ',
+  ' ',' ',' ',' ','p',' ',':',' ','S','h','o','w',' ','c','o',
+  'm','p','i','l','e','d',' ','p','r','o','c','e','d','u','r',
+  'e','s',#000,'*','*','2','*','_','l',' ',':',' ','S','h','o',
+  'w',' ','l','i','n','e','n','u','m','b','e','r','s',' ',' ',
+  ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','c',' ',':',' ','S',
+  'h','o','w',' ','c','o','n','d','i','t','i','o','n','a','l',
+  's',#000,'*','*','2','*','_','a',' ',':',' ','S','h','o','w',
+  ' ','e','v','e','r','y','t','h','i','n','g',' ',' ',' ',' ',
+  ' ',' ',' ',' ',' ',' ',' ',' ',' ','0',' ',':',' ','S','h',
+  'o','w',' ','n','o','t','h','i','n','g',' ','(','e','x','c',
+  'e','p','t',' ','e','r','r','o','r','s',')',#000,'*','*','1',
+  'X','_','e','x','e','c','u','t','a','b','l','e',' ','o','p',
+  't','i','o','n','s',#000,'*','L','2','X','c','_','l','i','n',
+  'k',' ','w','i','t','h',' ','t','h','e',' ','c',' ','l','i',
+  'b','r','a','r','y',#000,'*','*','2','X','s','_','s','t','r',
+  'i','p',' ','a','l','l',' ','s','y','m','b','o','l','s',' ',
+  'f','r','o','m',' ','e','x','e','c','u','t','a','b','l','e',
+  #000,'*','*','0','*','_','P','r','o','c','e','s','s','o','r',
+  ' ','s','p','e','c','i','f','i','c',' ','o','p','t','i','o',
+  'n','s',':',#000,'3','*','1','A','_','o','u','t','p','u','t',
+  ' ','f','o','r','m','a','t',#000,'3','*','2','A','a','t','t',
+  '_','A','T','&','T',' ','a','s','s','e','m','b','l','e','r',
+  #000,'3','*','2','A','o','_','c','o','f','f',' ','f','i','l',
+  'e',' ','u','s','i','n','g',' ','G','N','U',' ','A','S',#000,
+  '3','*','2','A','o','b','j','_','O','M','F',' ','f','i','l',
+  'e',' ','u','s','i','n','g',' ','N','A','S','M',#000,'3','*',
+  '2','A','n','a','s','m','_','c','o','f','f',' ','f','i','l',
+  'e',' ','u','s','i','n','g',' ','N','A','S','M',#000,'3','*',
+  '2','A','m','a','s','m','_','a','s','s','e','m','b','l','e',
+  'r',' ','f','o','r',' ','t','h','e',' ','M','i','c','r','o',
+  's','o','f','t','/','B','o','r','l','a','n','d','/','W','a',
+  't','c','o','m',' ','a','s','s','e','m','b','l','e','r',#000,
+  '3','*','1','R','_','a','s','s','e','m','b','l','e','r',' ',
+  'r','e','a','d','i','n','g',' ','s','t','y','l','e',#000,'3',
+  '*','2','R','a','t','t','_','r','e','a','d',' ','A','T','&',
+  'T',' ','s','t','y','l','e',' ','a','s','s','e','m','b','l',
+  'e','r',#000,'3','*','2','R','i','n','t','e','l','_','r','e',
+  'a','d',' ','I','n','t','e','l',' ','s','t','y','l','e',' ',
+  'a','s','s','e','m','b','l','e','r',#000,'3','*','2','R','d',
+  'i','r','e','c','t','_','c','o','p','y',' ','a','s','s','e',
+  'm','b','l','e','r',' ','t','e','x','t',' ','d','i','r','e',
+  'c','t','l','y',' ','t','o',' ','a','s','s','e','m','b','l',
+  'e','r',' ','f','i','l','e',#000,'3','*','1','O','_','o','p',
+  't','i','m','i','z','a','t','i','o','n','s',#000,'3','*','2',
+  'O','a','_','s','i','m','p','l','e',' ','o','p','t','i','m',
+  'i','z','a','t','i','o','n','s',#000,'3','*','2','O','g','_',
+  'o','p','t','i','m','i','z','e',' ','f','o','r',' ','s','i',
+  'z','e',#000,'3','*','2','O','G','_','o','p','t','i','m','i',
+  'z','e',' ','f','o','r',' ','t','i','m','e',#000,'3','*','2',
+  'O','x','_','o','p','t','i','m','i','z','e',' ','m','a','x',
+  'i','m','u','m',#000,'3','*','2','O','z','_','u','n','c','e',
+  'r','t','a','i','n',' ','o','p','t','i','m','i','z','e','s',
+  ' ','(','s','e','e',' ','d','o','c','s',')',#000,'3','*','2',
+  'O','2','_','o','p','t','i','m','i','z','e',' ','f','o','r',
+  ' ','P','e','n','t','i','u','m',' ','I','I',' ','(','t','m',
+  ')',#000,'3','*','2','O','3','_','o','p','t','i','m','i','z',
+  'e',' ','f','o','r',' ','i','3','8','6',#000,'3','*','2','O',
+  '4','_','o','p','t','i','m','i','z','e',' ','f','o','r',' ',
+  'i','4','8','6',#000,'3','*','2','O','5','_','o','p','t','i',
+  'm','i','z','e',' ','f','o','r',' ','P','e','n','t','i','u',
+  'm',' ','(','t','m',')',#000,'3','*','2','O','6','_','o','p',
+  't','i','m','i','z','a','t','i','o','n','s',' ','f','o','r',
+  ' ','P','e','n','t','i','u','m','P','r','o',' ','(','t','m',
+  ')',#000,'6','*','1','A','_','o','u','t','p','u','t',' ','f',
+  'o','r','m','a','t',#000,'6','*','2','A','g','a','s','_','G',
+  'N','U',' ','M','o','t','o','r','o','l','a',' ','a','s','s',
+  'e','m','b','l','e','r',#000,'6','*','2','A','o','_','U','N',
+  'I','X',' ','o','-','f','i','l','e',#000,'6','*','2','A','m',
+  '_','S','t','a','n','d','a','r','d',' ','M','o','t','o','r',
+  'o','l','a',' ','a','s','s','e','m','b','l','e','r',#000,'6',
+  '*','2','A','i','_','M','I','T',' ','S','y','n','t','a','x',
+  ' ','(','o','l','d',' ','G','A','S',')',#000,'6','*','1','O',
+  '_','o','p','t','i','m','i','z','a','t','i','o','n','s',#000,
+  '6','*','2','O','a','_','s','i','m','p','l','e',' ','o','p',
+  't','i','m','i','z','a','t','i','o','n','s',#000,'6','*','2',
+  'O','g','_','o','p','t','i','m','i','z','e',' ','f','o','r',
+  ' ','s','i','z','e',#000,'6','*','2','O','G','_','o','p','t',
+  'i','m','i','z','e',' ','f','o','r',' ','t','i','m','e',#000,
+  '6','*','2','O','x','_','o','p','t','i','m','i','z','e',' ',
+  'm','a','x','i','m','u','m',#000,'6','*','2','O','2','_','t',
+  'a','r','g','e','t',' ','i','s',' ','a',' ','M','C','6','8',
+  '0','2','0','+',' ','p','r','o','c','e','s','s','o','r',#000,
+  '*','*','1','*','_',#000,'*','*','1','?','_','s','h','o','w',
+  's',' ','t','h','i','s',' ','h','e','l','p',#000,'*','*','1',
+  'h','_','s','h','o','w','s',' ','t','h','i','s',' ','h','e',
+  'l','p',' ','w','i','t','h','o','u','t',' ','w','a','i','t',
+  'i','n','g',#000);

+ 26 - 3
compiler/pass_1.pas

@@ -1630,7 +1630,7 @@ unit pass_1;
            exit;
 
        { some string functions don't need conversion, so treat them separatly }
-         if p^.left^.resulttype^.deftype=stringdef then
+         if (p^.left^.resulttype^.deftype=stringdef) and (assigned(p^.right^.resulttype)) then
           begin
             if not (p^.right^.resulttype^.deftype in [stringdef,orddef]) then
              begin
@@ -2131,6 +2131,12 @@ unit pass_1;
        if codegenerror then
          exit;
 
+       if not assigned(p^.left^.resulttype) then
+        begin
+          codegenerror:=true;
+          exit;
+        end;
+
        { remove obsolete type conversions }
        if is_equal(p^.left^.resulttype,p^.resulttype) then
          begin
@@ -3411,7 +3417,6 @@ unit pass_1;
                               begin
                                 if assigned(hp^.left^.resulttype) then
                                   begin
-
                                    if hp^.left^.resulttype^.deftype=floatdef then
                                      begin
                                         isreal:=true;
@@ -4487,7 +4492,25 @@ unit pass_1;
 end.
 {
   $Log$
-  Revision 1.2  1998-03-26 11:18:31  florian
+  Revision 1.3  1998-03-28 23:09:56  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.2  1998/03/26 11:18:31  florian
     - switch -Sa removed
     - support of a:=b:=0 removed
 

+ 63 - 45
compiler/pstatmnt.pas

@@ -881,54 +881,54 @@ unit pstatmnt;
                        code:=genzeronode(failn);
                     end;
             _BREAK:
+              begin
+                 consume(_BREAK);
+                 code:=genzeronode(breakn);
+              end;
+            _EXIT : code:=exit_statement;
+            _ASM : code:=_asm_statement;
+         else
            begin
-                  consume(_BREAK);
-                  code:=genzeronode(breakn);
-               end;
-                        _EXIT : code:=exit_statement;
-                        _ASM : code:=_asm_statement;
-                        else
-                           begin
-                                  if (token=INTCONST) or
-                    ((token=ID) and
-                      not((cs_delphi2_compatible in aktswitches) and
-                        (pattern='RESULT'))) then
-                                        begin
-                                           getsym(pattern,true);
-                                           if srsym^.typ=labelsym then
-                                                 begin
-                                                        consume(token);
-                                                        consume(COLON);
-                                                        if plabelsym(srsym)^.defined then
-                                                          Message(sym_e_label_already_defined);
-                                                        plabelsym(srsym)^.defined:=true;
-
-                                                        { statement modifies srsym }
-                                                        labelnr:=plabelsym(srsym)^.number;
-
-                                                        { the pointer to the following instruction }
-                                                        { isn't a very clean way                   }
+              if (token=INTCONST) or
+                ((token=ID) and
+                not((cs_delphi2_compatible in aktswitches) and
+                (pattern='RESULT'))) then
+                begin
+                   getsym(pattern,false);
+                   if assigned(srsym) and (srsym^.typ=labelsym) then
+                     begin
+                        consume(token);
+                        consume(COLON);
+                        if plabelsym(srsym)^.defined then
+                          Message(sym_e_label_already_defined);
+                        plabelsym(srsym)^.defined:=true;
+
+                        { statement modifies srsym }
+                        labelnr:=plabelsym(srsym)^.number;
+
+                        { the pointer to the following instruction }
+                        { isn't a very clean way                   }
 {$ifdef tp}
-                                                        code:=gensinglenode(labeln,statement);
+                        code:=gensinglenode(labeln,statement);
 {$else}
-                                                        code:=gensinglenode(labeln,statement());
+                        code:=gensinglenode(labeln,statement());
 {$endif}
-                                                        code^.labelnr:=labelnr;
-                                                        { sorry, but there is a jump the easiest way }
-                                                        goto ready;
-                                                 end;
-                                        end;
-                                  p:=expr;
-                                  if (p^.treetype<>calln) and
-                                    (p^.treetype<>assignn) and
-                                    (p^.treetype<>inlinen) then
-                                    Message(cg_e_illegal_expression);
-                                  code:=p;
-                           end;
-                 end;
-          ready:
-                 statement:=code;
-          end;
+                        code^.labelnr:=labelnr;
+                        { sorry, but there is a jump the easiest way }
+                        goto ready;
+                     end;
+                end;
+              p:=expr;
+              if (p^.treetype<>calln) and
+                (p^.treetype<>assignn) and
+                (p^.treetype<>inlinen) then
+                Message(cg_e_illegal_expression);
+              code:=p;
+           end;
+         end;
+         ready:
+         statement:=code;
+      end;
 
     function block(islibrary : boolean) : ptree;
 
@@ -1064,7 +1064,25 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.2  1998-03-26 11:18:31  florian
+  Revision 1.3  1998-03-28 23:09:56  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.2  1998/03/26 11:18:31  florian
     - switch -Sa removed
     - support of a:=b:=0 removed
 

+ 30 - 5
compiler/scanner.pas

@@ -427,9 +427,11 @@ for the last instruction of an include file !}
 
     procedure handle_switches;
 
-      function read_string : string;
+      function read_original_string : string;
+
         var
            hs : string;
+
         begin
            hs:='';
            while c in ['A'..'Z','a'..'z','_','0'..'9'] do
@@ -437,9 +439,14 @@ for the last instruction of an include file !}
               hs:=hs+c;
               nextchar;
             end;
-           read_string:=upper(hs);
+           read_original_string:=hs;
         end;
 
+      function read_string : string;
+
+        begin
+           read_string:=upper(read_original_string);
+        end;
 
       function read_number : longint;
 
@@ -1208,7 +1215,7 @@ for the last instruction of an include file !}
          else if hs='LINKLIB' then
            begin
              skipspace;
-             hs:=FixFileName(read_string);
+             hs:=read_original_string;
              Linker.AddLibraryFile(hs);
              current_module^.linklibfiles.insert(hs);
            end
@@ -2066,8 +2073,26 @@ for the last instruction of an include file !}
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:57  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:15  root
+  * Restored version
 
   Revision 1.43  1998/03/24 21:48:34  florian
     * just a couple of fixes applied:

+ 27 - 2
compiler/types.pas

@@ -432,6 +432,13 @@ unit types;
          hp1,hp2 : pdefcoll;
 
       begin
+         { both types must exists }
+         if not (assigned(def1) and assigned(def2)) then
+          begin
+            is_equal:=false;
+            exit;
+          end;
+
          { be sure, that if there is a stringdef, that this is def1 }
          if def2^.deftype=stringdef then
            begin
@@ -861,8 +868,26 @@ unit types;
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:57  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:15  root
+  * Restored version
 
   Revision 1.24  1998/03/21 23:59:40  florian
     * indexed properties fixed

+ 21 - 9
compiler/verb_def.pas

@@ -156,14 +156,8 @@ end;
 
 
 function _internalerror(i : longint) : boolean;
-var
-  temp : string;
 begin
-  if assigned(current_module^.current_inputfile) then
-   temp:=current_module^.current_inputfile^.get_file_line+': '
-  else
-   temp:='';
-  comment(V_Error,temp+'Internal error '+tostr(i));
+  comment(V_Fatal,'Internal error '+tostr(i));
   _internalerror:=true;
 end;
 
@@ -245,8 +239,26 @@ begin
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:57  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:15  root
+  * Restored version
 
   Revision 1.6  1998/03/10 16:43:34  peter
     * fixed Fatal error writting

+ 22 - 4
compiler/verbose.pas

@@ -34,7 +34,7 @@ uses messages;
 {$i msgidx.inc}
 
 Const
-  MaxErrorCount = 50;
+  MaxErrorCount : longint = 50;
 { <$100 can include file and linenr info }
   V_Fatal       = $0;
   V_Error       = $1;
@@ -197,7 +197,7 @@ begin
           'E' : begin
                   v:=v or V_Error;
                   inc(errorcount);
-                  dostop:=(errorcount>maxerrorcount);
+                  dostop:=(errorcount>=maxerrorcount);
                 end;
           'W' : v:=v or V_Warning;
           'N' : v:=v or V_Note;
@@ -290,8 +290,26 @@ end.
 
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-03-28 23:09:57  florian
+    * secondin bugfix (m68k and i386)
+    * overflow checking bugfix (m68k and i386) -- pretty useless in
+      secondadd, since everything is done using 32-bit
+    * loading pointer to routines hopefully fixed (m68k)
+    * flags problem with calls to RTL internal routines fixed (still strcmp
+      to fix) (m68k)
+    * #ELSE was still incorrect (didn't take care of the previous level)
+    * problem with filenames in the command line solved
+    * problem with mangledname solved
+    * linking name problem solved (was case insensitive)
+    * double id problem and potential crash solved
+    * stop after first error
+    * and=>test problem removed
+    * correct read for all float types
+    * 2 sigsegv fixes and a cosmetic fix for Internal Error
+    * push/pop is now correct optimized (=> mov (%esp),reg)
+
+  Revision 1.1.1.1  1998/03/25 11:18:15  root
+  * Restored version
 
   Revision 1.17  1998/03/10 16:43:34  peter
     * fixed Fatal error writting