Parcourir la source

* second part bug report 1996 fix, testrange in cordconstnode
only called if option is set (also make parsing a tiny faster)

carl il y a 23 ans
Parent
commit
6c2bede5a8
11 fichiers modifiés avec 272 ajouts et 192 suppressions
  1. 83 77
      compiler/nadd.pas
  2. 7 3
      compiler/ncal.pas
  3. 30 16
      compiler/ncnv.pas
  4. 27 11
      compiler/ncon.pas
  5. 6 2
      compiler/nflw.pas
  6. 62 48
      compiler/ninl.pas
  7. 8 4
      compiler/nmat.pas
  8. 10 4
      compiler/nset.pas
  9. 24 20
      compiler/pexpr.pas
  10. 9 5
      compiler/pinline.pas
  11. 6 2
      compiler/pstatmnt.pas

+ 83 - 77
compiler/nadd.pas

@@ -277,23 +277,23 @@ implementation
                 muln :
                   t:=genintconstnode(lv*rv);
                 xorn :
-                  t:=cordconstnode.create(lv xor rv,left.resulttype);
+                  t:=cordconstnode.create(lv xor rv,left.resulttype,true);
                 orn :
-                  t:=cordconstnode.create(lv or rv,left.resulttype);
+                  t:=cordconstnode.create(lv or rv,left.resulttype,true);
                 andn :
-                  t:=cordconstnode.create(lv and rv,left.resulttype);
+                  t:=cordconstnode.create(lv and rv,left.resulttype,true);
                 ltn :
-                  t:=cordconstnode.create(ord(lv<rv),booltype);
+                  t:=cordconstnode.create(ord(lv<rv),booltype,true);
                 lten :
-                  t:=cordconstnode.create(ord(lv<=rv),booltype);
+                  t:=cordconstnode.create(ord(lv<=rv),booltype,true);
                 gtn :
-                  t:=cordconstnode.create(ord(lv>rv),booltype);
+                  t:=cordconstnode.create(ord(lv>rv),booltype,true);
                 gten :
-                  t:=cordconstnode.create(ord(lv>=rv),booltype);
+                  t:=cordconstnode.create(ord(lv>=rv),booltype,true);
                 equaln :
-                  t:=cordconstnode.create(ord(lv=rv),booltype);
+                  t:=cordconstnode.create(ord(lv=rv),booltype,true);
                 unequaln :
-                  t:=cordconstnode.create(ord(lv<>rv),booltype);
+                  t:=cordconstnode.create(ord(lv<>rv),booltype,true);
                 slashn :
                   begin
                     { int/int becomes a real }
@@ -350,17 +350,17 @@ implementation
                       t:=crealconstnode.create(lvd/rvd,pbestrealtype^);
                    end;
                  ltn :
-                   t:=cordconstnode.create(ord(lvd<rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd<rvd),booltype,true);
                  lten :
-                   t:=cordconstnode.create(ord(lvd<=rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd<=rvd),booltype,true);
                  gtn :
-                   t:=cordconstnode.create(ord(lvd>rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd>rvd),booltype,true);
                  gten :
-                   t:=cordconstnode.create(ord(lvd>=rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd>=rvd),booltype,true);
                  equaln :
-                   t:=cordconstnode.create(ord(lvd=rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd=rvd),booltype,true);
                  unequaln :
-                   t:=cordconstnode.create(ord(lvd<>rvd),booltype);
+                   t:=cordconstnode.create(ord(lvd<>rvd),booltype,true);
                  else
                    CGMessage(type_e_mismatch);
               end;
@@ -389,17 +389,17 @@ implementation
                       t:=cstringconstnode.createwstr(ws1);
                    end;
                  ltn :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<0),booltype,true);
                  lten :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<=0),booltype,true);
                  gtn :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>0),booltype,true);
                  gten :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)>=0),booltype,true);
                  equaln :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)=0),booltype,true);
                  unequaln :
-                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),booltype);
+                   t:=cordconstnode.create(byte(comparewidestrings(ws1,ws2)<>0),booltype,true);
               end;
               donewidestring(ws1);
               donewidestring(ws2);
@@ -453,17 +453,17 @@ implementation
                  addn :
                    t:=cstringconstnode.createpchar(concatansistrings(s1,s2,l1,l2),l1+l2);
                  ltn :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype,true);
                  lten :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),booltype,true);
                  gtn :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),booltype,true);
                  gten :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),booltype,true);
                  equaln :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),booltype,true);
                  unequaln :
-                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),booltype);
+                   t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),booltype,true);
               end;
               ansistringdispose(s1,l1);
               ansistringdispose(s2,l2);
@@ -527,7 +527,7 @@ implementation
                   b:=false;
                   break;
                 end;
-              t:=cordconstnode.create(ord(b),booltype);
+              t:=cordconstnode.create(ord(b),booltype,true);
            end;
         equaln :
            begin
@@ -538,7 +538,7 @@ implementation
                   b:=false;
                   break;
                 end;
-              t:=cordconstnode.create(ord(b),booltype);
+              t:=cordconstnode.create(ord(b),booltype,true);
            end;
         lten :
            begin
@@ -550,65 +550,65 @@ implementation
                    b := false;
                    break
                  end;
-             t := cordconstnode.create(ord(b),booltype);
+             t := cordconstnode.create(ord(b),booltype,true);
            end;
             gten :
                    begin
-                 b := true;
-                 for i := 0 to 31 Do
+                    b := true;
+                    for i := 0 to 31 Do
                        If (tsetconstnode(left).value_set^[i] And tsetconstnode(right).value_set^[i]) <>
                        tsetconstnode(right).value_set^[i] Then
                          begin
-                       b := false;
-                       break
+                          b := false;
+                          break
                          end;
-                     t := cordconstnode.create(ord(b),booltype);
+                     t := cordconstnode.create(ord(b),booltype,true);
                    end;
               end;
 
 {$else}
-              case nodetype of
-                 addn :
-            begin
-            resultset:=tsetconstnode(right).value_set^ + tsetconstnode(left).value_set^;
+           case nodetype of
+           addn :
+             begin
+                  resultset:=tsetconstnode(right).value_set^ + tsetconstnode(left).value_set^;
                         t:=csetconstnode.create(@resultset,left.resulttype);
-            end;
-                 muln :
-            begin
+             end;
+            muln :
+              begin
             resultset:=tsetconstnode(right).value_set^ * tsetconstnode(left).value_set^;
                         t:=csetconstnode.create(@resultset,left.resulttype);
-            end;
-                 subn :
-            begin
-            resultset:=tsetconstnode(left).value_set^ - tsetconstnode(right).value_set^;
+              end;
+           subn :
+              begin
+                resultset:=tsetconstnode(left).value_set^ - tsetconstnode(right).value_set^;
                         t:=csetconstnode.create(@resultset,left.resulttype);
-            end;
-                 symdifn :
-                    begin
-            resultset:=tsetconstnode(right).value_set^ >< tsetconstnode(left).value_set^;
+              end;
+           symdifn :
+              begin
+                resultset:=tsetconstnode(right).value_set^ >< tsetconstnode(left).value_set^;
                     t:=csetconstnode.create(@resultset,left.resulttype);
-                    end;
-                 unequaln :
-                    begin
-            b:=tsetconstnode(right).value_set^ <> tsetconstnode(left).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype);
-                    end;
-                 equaln :
-                    begin
-            b:=tsetconstnode(right).value_set^ = tsetconstnode(left).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype);
-                    end;
-                 lten :
-                    begin
-            b:=tsetconstnode(left).value_set^ <= tsetconstnode(right).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype);
-                    end;
-                 gten :
-                    begin
-            b:=tsetconstnode(left).value_set^ >= tsetconstnode(right).value_set^;
-                    t:=cordconstnode.create(byte(b),booltype);
-                    end;
               end;
+           unequaln :
+              begin
+                b:=tsetconstnode(right).value_set^ <> tsetconstnode(left).value_set^;
+                t:=cordconstnode.create(byte(b),booltype,true);
+              end;
+           equaln :
+              begin
+                b:=tsetconstnode(right).value_set^ = tsetconstnode(left).value_set^;
+                t:=cordconstnode.create(byte(b),booltype,true);
+              end;
+           lten :
+              begin
+                b:=tsetconstnode(left).value_set^ <= tsetconstnode(right).value_set^;
+                t:=cordconstnode.create(byte(b),booltype,true);
+              end;
+           gten :
+              begin
+                b:=tsetconstnode(left).value_set^ >= tsetconstnode(right).value_set^;
+                t:=cordconstnode.create(byte(b),booltype,true);
+              end;
+           end;
 {$endif}
               result:=t;
               exit;
@@ -1077,7 +1077,8 @@ implementation
                   CGMessage(type_e_mismatch);
                 if (rd.deftype=pointerdef) and
                    (tpointerdef(rd).pointertype.def.size>1) then
-                  left:=caddnode.create(muln,left,cordconstnode.create(tpointerdef(rd).pointertype.def.size,s32bittype));
+                  left:=caddnode.create(muln,left,
+                      cordconstnode.create(tpointerdef(rd).pointertype.def.size,s32bittype,true));
               end
             else
               CGMessage(type_e_mismatch);
@@ -1098,7 +1099,8 @@ implementation
                   CGMessage(type_e_mismatch);
                 if (ld.deftype=pointerdef) and
                    (tpointerdef(ld).pointertype.def.size>1) then
-                  right:=caddnode.create(muln,right,cordconstnode.create(tpointerdef(ld).pointertype.def.size,s32bittype));
+                  right:=caddnode.create(muln,right,
+                    cordconstnode.create(tpointerdef(ld).pointertype.def.size,s32bittype,true));
               end
             else
               CGMessage(type_e_mismatch);
@@ -1190,7 +1192,7 @@ implementation
                     { compare the length with 0 }
                     result := caddnode.create(nodetype,
                       cinlinenode.create(in_length_x,false,left),
-                      cordconstnode.create(0,s32bittype))
+                      cordconstnode.create(0,s32bittype,false))
                   else
                     begin
                       { compare the pointer with nil (for ansistrings etc), }
@@ -1214,7 +1216,7 @@ implementation
                 ccallparanode.create(right,ccallparanode.create(left,nil)));
               { and compare its result with 0 according to the original operator }
               result := caddnode.create(nodetype,result,
-                cordconstnode.create(0,s32bittype));
+                cordconstnode.create(0,s32bittype,false));
               left := nil;
               right := nil;
               firstpass(result);
@@ -1409,7 +1411,7 @@ implementation
 
         { otherwise, create the parameters for the helper }
         right := ccallparanode.create(
-          cordconstnode.create(ord(cs_check_overflow in aktlocalswitches),booltype),
+          cordconstnode.create(ord(cs_check_overflow in aktlocalswitches),booltype,true),
           ccallparanode.create(right,ccallparanode.create(left,nil)));
         left := nil;
         if torddef(resulttype.def).typ = s64bit then
@@ -1812,7 +1814,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.63  2002-09-04 19:32:56  jonas
+  Revision 1.64  2002-09-07 12:16:05  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.63  2002/09/04 19:32:56  jonas
     * changed some ctypeconvnode/toggleflag(nf_explizit) combo's to
       ctypeconvnode.create_explicit() statements
 

+ 7 - 3
compiler/ncal.pas

@@ -642,7 +642,7 @@ implementation
                  else
                    begin
                      hightree:=caddnode.create(subn,geninlinenode(in_length_x,false,left.getcopy),
-                                               cordconstnode.create(1,s32bittype));
+                                               cordconstnode.create(1,s32bittype,false));
                      loadconst:=false;
                    end;
                end;
@@ -651,7 +651,7 @@ implementation
           len:=0;
         end;
         if loadconst then
-          hightree:=cordconstnode.create(len,s32bittype)
+          hightree:=cordconstnode.create(len,s32bittype,true)
         else
           hightree:=ctypeconvnode.create(hightree,s32bittype);
         firstpass(hightree);
@@ -2595,7 +2595,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.96  2002-09-05 14:53:41  peter
+  Revision 1.97  2002-09-07 12:16:05  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.96  2002/09/05 14:53:41  peter
     * fixed old callnode.det_resulttype code
     * old ncal code is default again
 

+ 30 - 16
compiler/ncnv.pas

@@ -593,7 +593,7 @@ implementation
         result := ccallnode.createinternres(
           'fpc_'+tstringdef(left.resulttype.def).stringtypname+
           '_to_chararray',ccallparanode.create(left,ccallparanode.create(
-          cordconstnode.create(arrsize,s32bittype),nil)),resulttype);
+          cordconstnode.create(arrsize,s32bittype,true),nil)),resulttype);
         left := nil;
       end;
 
@@ -702,11 +702,11 @@ implementation
                left.toggleflag(nf_explizit);
                if (target_info.endian = endian_little) then
                  left := caddnode.create(orn,
-                   cshlshrnode.create(shln,left,cordconstnode.create(8,s32bittype)),
-                   cordconstnode.create(1,s32bittype))
+                   cshlshrnode.create(shln,left,cordconstnode.create(8,s32bittype,false)),
+                   cordconstnode.create(1,s32bittype,false))
                else
                  left := caddnode.create(orn,left,
-                   cordconstnode.create(1 shl 8,s32bittype));
+                   cordconstnode.create(1 shl 8,s32bittype,false));
                left := ctypeconvnode.create(left,u16bittype);
                left.toggleflag(nf_explizit);
                resulttypepass(left);
@@ -743,14 +743,16 @@ implementation
                 (torddef(left.resulttype.def).typ=uwidechar) then
               begin
                 hp:=cordconstnode.create(
-                      ord(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value))),cchartype);
+                      ord(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value))),
+                      cchartype,true);
                 result:=hp;
               end
              else if (torddef(resulttype.def).typ=uwidechar) and
                      (torddef(left.resulttype.def).typ=uchar) then
               begin
                 hp:=cordconstnode.create(
-                      asciichar2unicode(chr(tordconstnode(left).value)),cwidechartype);
+                      asciichar2unicode(chr(tordconstnode(left).value)),
+                      cwidechartype,true);
                 result:=hp;
               end
              else
@@ -1065,7 +1067,8 @@ implementation
                begin
                  if left.nodetype=ordconstn then
                   begin
-                    hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                    hp:=cordconstnode.create(tordconstnode(left).value,
+                       resulttype,true);
                     result:=hp;
                     exit;
                   end
@@ -1083,7 +1086,8 @@ implementation
                 begin
                   if left.nodetype=ordconstn then
                    begin
-                     hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                     hp:=cordconstnode.create(tordconstnode(left).value,
+                       resulttype,true);
                      result:=hp;
                      exit;
                    end
@@ -1097,7 +1101,7 @@ implementation
                { nil to ordinal node }
                else if (left.nodetype=niln) and is_ordinal(resulttype.def) then
                   begin
-                     hp:=cordconstnode.create(0,resulttype);
+                     hp:=cordconstnode.create(0,resulttype,true);
                      result:=hp;
                      exit;
                   end
@@ -1106,7 +1110,8 @@ implementation
               else if is_ordinal(resulttype.def) and
                       (left.nodetype=pointerconstn) then
                 begin
-                   hp:=cordconstnode.create(tpointerconstnode(left).value,resulttype);
+                   hp:=cordconstnode.create(tpointerconstnode(left).value,
+                     resulttype,true);
                    result:=hp;
                    exit;
                 end
@@ -1143,7 +1148,8 @@ implementation
                  begin
                    if left.nodetype=ordconstn then
                     begin
-                      hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                      hp:=cordconstnode.create(tordconstnode(left).value,
+                        resulttype,true);
                       result:=hp;
                       exit;
                     end
@@ -1161,7 +1167,8 @@ implementation
                  begin
                    if left.nodetype=ordconstn then
                     begin
-                      hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                      hp:=cordconstnode.create(tordconstnode(left).value,
+                        resulttype,true);
                       result:=hp;
                       exit;
                     end
@@ -1179,7 +1186,8 @@ implementation
                  begin
                    if left.nodetype=ordconstn then
                     begin
-                      hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                      hp:=cordconstnode.create(tordconstnode(left).value,
+                        resulttype,true);
                       result:=hp;
                       exit;
                     end
@@ -1196,7 +1204,8 @@ implementation
                  begin
                    if left.nodetype=ordconstn then
                     begin
-                      hp:=cordconstnode.create(tordconstnode(left).value,resulttype);
+                      hp:=cordconstnode.create(tordconstnode(left).value,
+                         resulttype,true);
                       result:=hp;
                       exit;
                     end
@@ -1215,7 +1224,8 @@ implementation
                  begin
                    if left.nodetype=pointerconstn then
                     begin
-                      hp:=cordconstnode.create(tpointerconstnode(left).value,resulttype);
+                      hp:=cordconstnode.create(tpointerconstnode(left).value,
+                         resulttype,true);
                       result:=hp;
                       exit;
                     end
@@ -2027,7 +2037,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.77  2002-09-05 05:56:07  jonas
+  Revision 1.78  2002-09-07 12:16:04  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.77  2002/09/05 05:56:07  jonas
     - reverted my last commit, it was completely bogus :(
 
   Revision 1.75  2002/09/02 19:24:42  peter

+ 27 - 11
compiler/ncon.pas

@@ -51,7 +51,12 @@ interface
        tordconstnode = class(tnode)
           restype : ttype;
           value : TConstExprInt;
-          constructor create(v : tconstexprint;const t:ttype);virtual;
+          rangecheck : boolean;
+          { create an ordinal constant node of the specified type and value. 
+            _rangecheck determines if the value of the ordinal should be checked
+            against the ranges of the type definition.
+          }  
+          constructor create(v : tconstexprint;const t:ttype; _rangecheck : boolean);virtual;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure derefimpl;override;
@@ -180,11 +185,11 @@ implementation
          { maxcardinal }
          i2 := i+i+1;
          if (v<=i) and (v>=-i-1) then
-           genintconstnode:=cordconstnode.create(v,s32bittype)
+           genintconstnode:=cordconstnode.create(v,s32bittype,true)
          else if (v > i) and (v <= i2) then
-           genintconstnode:=cordconstnode.create(v,u32bittype)
+           genintconstnode:=cordconstnode.create(v,u32bittype,true)
          else
-           genintconstnode:=cordconstnode.create(v,cs64bittype);
+           genintconstnode:=cordconstnode.create(v,cs64bittype,true);
       end;
 
 
@@ -193,7 +198,7 @@ implementation
         htype : ttype;
       begin
          htype.setdef(v.definition);
-         genenumnode:=cordconstnode.create(v.value,htype);
+         genenumnode:=cordconstnode.create(v.value,htype,true);
       end;
 
 
@@ -312,15 +317,15 @@ implementation
               p1:=cstringconstnode.createpchar(pc,len);
             end;
           constchar :
-            p1:=cordconstnode.create(p.valueord,cchartype);
+            p1:=cordconstnode.create(p.valueord,cchartype,true);
           constreal :
             p1:=crealconstnode.create(pbestreal(p.valueptr)^,pbestrealtype^);
           constbool :
-            p1:=cordconstnode.create(p.valueord,booltype);
+            p1:=cordconstnode.create(p.valueord,booltype,true);
           constset :
             p1:=csetconstnode.create(pconstset(p.valueptr),p.consttype);
           constord :
-            p1:=cordconstnode.create(p.valueord,p.consttype);
+            p1:=cordconstnode.create(p.valueord,p.consttype,true);
           constpointer :
             p1:=cpointerconstnode.create(p.valueordptr,p.consttype);
           constnil :
@@ -410,12 +415,13 @@ implementation
                               TORDCONSTNODE
 *****************************************************************************}
 
-    constructor tordconstnode.create(v : tconstexprint;const t:ttype);
+    constructor tordconstnode.create(v : tconstexprint;const t:ttype;_rangecheck : boolean);
 
       begin
          inherited create(ordconstn);
          value:=v;
          restype:=t;
+         rangecheck := _rangecheck;
       end;
 
 
@@ -424,6 +430,10 @@ implementation
         inherited ppuload(t,ppufile);
         ppufile.gettype(restype);
         value:=ppufile.getexprint;
+        { normally, the value is already compiled, so we don't need 
+          to do once again a range check
+        }  
+        rangecheck := false;
       end;
 
 
@@ -458,7 +468,9 @@ implementation
       begin
         result:=nil;
         resulttype:=restype;
-        testrange(resulttype.def,value,false);
+        { only do range checking when explicitly asked for it }
+        if rangecheck then
+           testrange(resulttype.def,value,false);
       end;
 
     function tordconstnode.pass_1 : tnode;
@@ -912,7 +924,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.40  2002-08-22 11:21:44  florian
+  Revision 1.41  2002-09-07 12:16:04  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.40  2002/08/22 11:21:44  florian
     + register32 is now written by tnode.dowrite
     * fixed write of value of tconstnode
 

+ 6 - 2
compiler/nflw.pas

@@ -497,7 +497,7 @@ implementation
             end;
         if not is_constboolnode(condition) then
             aktstate.store_fact(condition,
-             cordconstnode.create(byte(checknegate),booltype))
+             cordconstnode.create(byte(checknegate),booltype,true))
         else
             condition.destroy;
     end;
@@ -1405,7 +1405,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.50  2002-09-01 18:47:00  peter
+  Revision 1.51  2002-09-07 12:16:04  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.50  2002/09/01 18:47:00  peter
     * assignn check in exitnode changed to use a separate boolean as the
       assignn can be changed to a calln
 

+ 62 - 48
compiler/ninl.pas

@@ -207,23 +207,26 @@ implementation
           begin
             { insert realtype parameter }
             newparas.right := ccallparanode.create(cordconstnode.create(
-              ord(tfloatdef(source.left.resulttype.def).typ),s32bittype),newparas.right);
+              ord(tfloatdef(source.left.resulttype.def).typ),s32bittype,true),
+               newparas.right);
             { if necessary, insert a fraction parameter }
             if not assigned(fracpara) then
               begin
                 tcallparanode(newparas.right).right := ccallparanode.create(
-                  cordconstnode.create(-1,s32bittype),tcallparanode(newparas.right).right);
+                  cordconstnode.create(-1,s32bittype,false),
+                   tcallparanode(newparas.right).right);
                 fracpara := tcallparanode(tcallparanode(newparas.right).right);
               end;
             { if necessary, insert a length para }
             if not assigned(lenpara) then
-              fracpara.right := ccallparanode.create(cordconstnode.create(-32767,s32bittype),
-                fracpara.right);
+              fracpara.right := ccallparanode.create(
+                cordconstnode.create(-32767,s32bittype,false),
+                   fracpara.right);
           end
         else
           { for a normal parameter, insert a only length parameter if one is missing }
           if not assigned(lenpara) then
-            newparas.right := ccallparanode.create(cordconstnode.create(-1,s32bittype),
+            newparas.right := ccallparanode.create(cordconstnode.create(-1,s32bittype,false),
               newparas.right);
 
         { remove the parameters from the original node so they won't get disposed, }
@@ -270,7 +273,7 @@ implementation
         {   parameter is gets lifted out of its original tcallparanode (see round }
         {   line 1306 of ncal.pas), so recreate a tcallparanode here (JM)         }
         left := ccallparanode.create(cordconstnode.create(
-          tfiledef(left.resulttype.def).typedfiletype.def.size,s32bittype),
+          tfiledef(left.resulttype.def).typedfiletype.def.size,s32bittype,true),
           ccallparanode.create(left,nil));
         { create the correct call }
         if inlinenumber=in_reset_typedfile then
@@ -449,7 +452,7 @@ implementation
           begin
             { add the typesize to the filepara }
             filepara.right := ccallparanode.create(cordconstnode.create(
-              tfiledef(filepara.resulttype.def).typedfiletype.def.size,s32bittype),nil);
+              tfiledef(filepara.resulttype.def).typedfiletype.def.size,s32bittype,true),nil);
 
             { check for "no parameters" (you need at least one extra para for typed files) }
             if not assigned(para) then
@@ -690,7 +693,8 @@ implementation
                         if not is_real then
                           begin
                             if not assigned(lenpara) then
-                              lenpara := ccallparanode.create(cordconstnode.create(0,s32bittype),nil)
+                              lenpara := ccallparanode.create(
+                                cordconstnode.create(0,s32bittype,false),nil)
                             else
                               { make sure we don't pass the successive }
                               { parameters too. We also already have a }
@@ -702,18 +706,18 @@ implementation
                           begin
                             if not assigned(lenpara) then
                               lenpara := ccallparanode.create(
-                                cordconstnode.create(-32767,s32bittype),nil);
+                                cordconstnode.create(-32767,s32bittype,false),nil);
                             { also create a default fracpara if necessary }
                             if not assigned(fracpara) then
                               fracpara := ccallparanode.create(
-                                cordconstnode.create(-1,s32bittype),nil);
+                                cordconstnode.create(-1,s32bittype,false),nil);
                             { add it to the lenpara }
                             lenpara.right := fracpara;
                             { and add the realtype para (this also removes the link }
                             { to any parameters coming after it)                    }
                             fracpara.right := ccallparanode.create(
                                 cordconstnode.create(ord(tfloatdef(para.left.resulttype.def).typ),
-                                s32bittype),nil);
+                                s32bittype,true),nil);
                           end;
                       end;
 
@@ -955,7 +959,7 @@ implementation
                     suffix := 'sint_';
                     { we also need a destsize para in this case }
                     sizepara := ccallparanode.create(cordconstnode.create
-                      (destpara.resulttype.def.size,s32bittype),nil);
+                      (destpara.resulttype.def.size,s32bittype,true),nil);
                   end;
                 u8bit,u16bit,u32bit:
                    suffix := 'uint_';
@@ -1061,7 +1065,7 @@ implementation
                     else
                       if not is_signed(t.def) then
                         v := cardinal(v);
-                  hp:=cordconstnode.create(v,t);
+                  hp:=cordconstnode.create(v,t,true);
                   resulttypepass(hp);
                   { fix high(qword) }
                   if not is_signed(t.def) and
@@ -1169,13 +1173,13 @@ implementation
                           if (vr>=2147483648.0) or (vr<=-2147483649.0) then
                             begin
                                CGMessage(parser_e_range_check_error);
-                               hp:=cordconstnode.create(1,s32bittype)
+                               hp:=cordconstnode.create(1,s32bittype,false)
                             end
                           else
-                            hp:=cordconstnode.create(trunc(vr),s32bittype)
+                            hp:=cordconstnode.create(trunc(vr),s32bittype,true)
                        end
                      else
-                      hp:=cordconstnode.create(trunc(vl),s32bittype);
+                      hp:=cordconstnode.create(trunc(vl),s32bittype,true);
                    end;
                  in_const_round :
                    begin
@@ -1184,13 +1188,13 @@ implementation
                           if (vr>=2147483647.5) or (vr<=-2147483648.5) then
                             begin
                                CGMessage(parser_e_range_check_error);
-                               hp:=cordconstnode.create(1,s32bittype)
+                               hp:=cordconstnode.create(1,s32bittype,false)
                             end
                           else
-                            hp:=cordconstnode.create(round(vr),s32bittype)
+                            hp:=cordconstnode.create(round(vr),s32bittype,true)
                        end
                      else
-                      hp:=cordconstnode.create(round(vl),s32bittype);
+                      hp:=cordconstnode.create(round(vl),s32bittype,true);
                    end;
                  in_const_frac :
                    begin
@@ -1211,35 +1215,35 @@ implementation
                      if isreal then
                       hp:=crealconstnode.create(abs(vr),pbestrealtype^)
                      else
-                      hp:=cordconstnode.create(abs(vl),left.resulttype);
+                      hp:=cordconstnode.create(abs(vl),left.resulttype,true);
                    end;
                  in_const_sqr :
                    begin
                      if isreal then
                       hp:=crealconstnode.create(sqr(vr),pbestrealtype^)
                      else
-                      hp:=cordconstnode.create(sqr(vl),left.resulttype);
+                      hp:=cordconstnode.create(sqr(vl),left.resulttype,true);
                    end;
                  in_const_odd :
                    begin
                      if isreal then
                       CGMessage1(type_e_integer_expr_expected,left.resulttype.def.typename)
                      else
-                      hp:=cordconstnode.create(byte(odd(vl)),booltype);
+                      hp:=cordconstnode.create(byte(odd(vl)),booltype,true);
                    end;
                  in_const_swap_word :
                    begin
                      if isreal then
                       CGMessage1(type_e_integer_expr_expected,left.resulttype.def.typename)
                      else
-                      hp:=cordconstnode.create((vl and $ff) shl 8+(vl shr 8),left.resulttype);
+                      hp:=cordconstnode.create((vl and $ff) shl 8+(vl shr 8),left.resulttype,true);
                    end;
                  in_const_swap_long :
                    begin
                      if isreal then
                       CGMessage(type_e_mismatch)
                      else
-                      hp:=cordconstnode.create((vl and $ffff) shl 16+(vl shr 16),left.resulttype);
+                      hp:=cordconstnode.create((vl and $ffff) shl 16+(vl shr 16),left.resulttype,true);
                    end;
                  in_const_ptr :
                    begin
@@ -1339,17 +1343,17 @@ implementation
                    begin
                      case inlinenumber of
                        in_lo_word :
-                         hp:=cordconstnode.create(tordconstnode(left).value and $ff,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value and $ff,left.resulttype,true);
                        in_hi_word :
-                         hp:=cordconstnode.create(tordconstnode(left).value shr 8,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value shr 8,left.resulttype,true);
                        in_lo_long :
-                         hp:=cordconstnode.create(tordconstnode(left).value and $ffff,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value and $ffff,left.resulttype,true);
                        in_hi_long :
-                         hp:=cordconstnode.create(tordconstnode(left).value shr 16,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value shr 16,left.resulttype,true);
                        in_lo_qword :
-                         hp:=cordconstnode.create(tordconstnode(left).value and $ffffffff,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value and $ffffffff,left.resulttype,true);
                        in_hi_qword :
-                         hp:=cordconstnode.create(tordconstnode(left).value shr 32,left.resulttype);
+                         hp:=cordconstnode.create(tordconstnode(left).value shr 32,left.resulttype,true);
                      end;
                      result:=hp;
                      goto myexit;
@@ -1387,7 +1391,8 @@ implementation
                 begin
                    if (left.nodetype=ordconstn) then
                     begin
-                      hp:=cordconstnode.create(tordconstnode(left).value,s32bittype);
+                      hp:=cordconstnode.create(
+                         tordconstnode(left).value,s32bittype,true);
                       result:=hp;
                       goto myexit;
                     end;
@@ -1475,7 +1480,8 @@ implementation
                         { evaluates length of constant strings direct }
                         if (left.nodetype=stringconstn) then
                          begin
-                           hp:=cordconstnode.create(tstringconstnode(left).len,s32bittype);
+                           hp:=cordconstnode.create(
+                             tstringconstnode(left).len,s32bittype,true);
                            result:=hp;
                            goto myexit;
                          end;
@@ -1486,7 +1492,7 @@ implementation
                         if is_char(left.resulttype.def) or
                            is_widechar(left.resulttype.def) then
                          begin
-                           hp:=cordconstnode.create(1,s32bittype);
+                           hp:=cordconstnode.create(1,s32bittype,false);
                            result:=hp;
                            goto myexit;
                          end
@@ -1500,7 +1506,7 @@ implementation
                          begin
                            srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
                            hp:=caddnode.create(addn,cloadnode.create(srsym,tloadnode(left).symtable),
-                                                    cordconstnode.create(1,s32bittype));
+                                                    cordconstnode.create(1,s32bittype,false));
                            result:=hp;
                            goto myexit;
                          end
@@ -1509,7 +1515,7 @@ implementation
                           begin
                             hp:=cordconstnode.create(tarraydef(left.resulttype.def).highrange-
                                                       tarraydef(left.resulttype.def).lowrange+1,
-                                                     s32bittype);
+                                                     s32bittype,true);
                             result:=hp;
                             goto myexit;
                           end
@@ -1571,7 +1577,7 @@ implementation
               in_seg_x :
                 begin
                   set_varstate(left,false);
-                  hp:=cordconstnode.create(0,s32bittype);
+                  hp:=cordconstnode.create(0,s32bittype,false);
                   result:=hp;
                   goto myexit;
                 end;
@@ -1594,9 +1600,9 @@ implementation
                    if left.nodetype=ordconstn then
                     begin
                       if inlinenumber=in_succ_x then
-                       hp:=cordconstnode.create(tordconstnode(left).value+1,left.resulttype)
+                       hp:=cordconstnode.create(tordconstnode(left).value+1,left.resulttype,false)
                       else
-                       hp:=cordconstnode.create(tordconstnode(left).value-1,left.resulttype);
+                       hp:=cordconstnode.create(tordconstnode(left).value-1,left.resulttype,false);
                       result:=hp;
                     end;
                 end;
@@ -1669,7 +1675,8 @@ implementation
                   resulttype:=voidtype;
                   { now we know the type of buffer }
                   srsym:=searchsymonlyin(systemunit,'SETTEXTBUF');
-                  hp:=ccallparanode.create(cordconstnode.create(tcallparanode(left).left.resulttype.def.size,s32bittype),left);
+                  hp:=ccallparanode.create(cordconstnode.create(
+                     tcallparanode(left).left.resulttype.def.size,s32bittype,true),left);
                   hp:=ccallnode.create(hp,tprocsym(srsym),systemunit,nil);
                   left:=nil;
                   result:=hp;
@@ -1731,7 +1738,8 @@ implementation
                       begin
                         if inlinenumber=in_low_x then
                          begin
-                           result:=cordconstnode.create(tarraydef(left.resulttype.def).lowrange,tarraydef(left.resulttype.def).rangetype);
+                           result:=cordconstnode.create(tarraydef(
+                            left.resulttype.def).lowrange,tarraydef(left.resulttype.def).rangetype,true);
                          end
                         else
                          begin
@@ -1756,7 +1764,8 @@ implementation
                               end
                            else
                             begin
-                              result:=cordconstnode.create(tarraydef(left.resulttype.def).highrange,tarraydef(left.resulttype.def).rangetype);
+                              result:=cordconstnode.create(tarraydef(
+                               left.resulttype.def).highrange,tarraydef(left.resulttype.def).rangetype,true);
                             end;
                          end;
                          resulttypepass(result);
@@ -1765,7 +1774,7 @@ implementation
                       begin
                         if inlinenumber=in_low_x then
                          begin
-                           hp:=cordconstnode.create(0,u8bittype);
+                           hp:=cordconstnode.create(0,u8bittype,false);
                            resulttypepass(hp);
                            result:=hp;
                          end
@@ -1780,7 +1789,7 @@ implementation
                             end
                            else
                             begin
-                              hp:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8bittype);
+                              hp:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8bittype,true);
                               resulttypepass(hp);
                               result:=hp;
                             end;
@@ -1983,7 +1992,7 @@ implementation
               end;
               if shiftconst <> 0 then
                 result := ctypeconvnode.create(cshlshrnode.create(shrn,left,
-                    cordconstnode.create(shiftconst,u32bittype)),resulttype)
+                    cordconstnode.create(shiftconst,u32bittype,false)),resulttype)
               else
                 result := ctypeconvnode.create(left,resulttype);
               left := nil;
@@ -1996,10 +2005,11 @@ implementation
                begin
                  srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
                  hp:=caddnode.create(addn,cloadnode.create(srsym,tloadnode(left).symtable),
-                                  cordconstnode.create(1,s32bittype));
+                                  cordconstnode.create(1,s32bittype,false));
                  if (left.resulttype.def.deftype=arraydef) and
                     (tarraydef(left.resulttype.def).elesize<>1) then
-                   hp:=caddnode.create(muln,hp,cordconstnode.create(tarraydef(left.resulttype.def).elesize,s32bittype));
+                   hp:=caddnode.create(muln,hp,cordconstnode.create(tarraydef(
+                     left.resulttype.def).elesize,s32bittype,true));
                  firstpass(hp);
                  result:=hp;
                end
@@ -2106,7 +2116,7 @@ implementation
                      end
                    else
                      { no, create constant 1 }
-                     hpp := cordconstnode.create(1,s32bittype);
+                     hpp := cordconstnode.create(1,s32bittype,false);
                    { addition/substraction depending on inc/dec }
                    if inlinenumber = in_inc_x then
                      hp := caddnode.create(addn,tcallparanode(left).left.getcopy,hpp)
@@ -2366,7 +2376,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.85  2002-09-02 19:24:42  peter
+  Revision 1.86  2002-09-07 12:16:04  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.85  2002/09/02 19:24:42  peter
     * array of char support for Str()
 
   Revision 1.84  2002/08/19 19:36:43  peter

+ 8 - 4
compiler/nmat.pas

@@ -257,9 +257,9 @@ implementation
                     left := caddnode.create(addn,left,
                       caddnode.create(andn,
                         cshlshrnode.create(sarn,left.getcopy,
-                          cordconstnode.create(shiftval,s32bittype)),
+                          cordconstnode.create(shiftval,s32bittype,false)),
                         cordconstnode.create(tordconstnode(right).value-1,
-                          right.resulttype)));
+                          right.resulttype,false)));
                     newtype := sarn;
                   end
                 else
@@ -630,7 +630,7 @@ implementation
                 else
                   CGMessage(type_e_mismatch);
               end;
-              t:=cordconstnode.create(v,left.resulttype);
+              t:=cordconstnode.create(v,left.resulttype,true);
               result:=t;
               exit;
            end;
@@ -747,7 +747,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.41  2002-09-03 16:26:26  daniel
+  Revision 1.42  2002-09-07 12:16:04  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.41  2002/09/03 16:26:26  daniel
     * Make Tprocdef.defs protected
 
   Revision 1.40  2002/08/25 11:32:33  peter

+ 10 - 4
compiler/nset.pas

@@ -272,7 +272,7 @@ implementation
              (tsetconstnode(right).value_set^ = [])) then
 {$endif oldset}
           begin
-            t:=cordconstnode.create(0,booltype);
+            t:=cordconstnode.create(0,booltype,false);
             resulttypepass(t);
             result:=t;
             exit;
@@ -282,9 +282,11 @@ implementation
          if (left.nodetype=ordconstn) and (right.nodetype=setconstn) then
           begin
         {$ifdef oldset}
-            t:=cordconstnode.create(byte(tordconstnode(left).value in byteset(tsetconstnode(right).value_set^)),booltype);
+            t:=cordconstnode.create(byte(tordconstnode(left).value in byteset(tsetconstnode(right).value_set^)),
+              booltype,true);
         {$else}
-            t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),booltype);
+            t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),
+              booltype,true);
         {$endif}
             resulttypepass(t);
             result:=t;
@@ -689,7 +691,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.32  2002-08-19 19:36:44  peter
+  Revision 1.33  2002-09-07 12:16:03  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.32  2002/08/19 19:36:44  peter
     * More fixes for cross unit inlining, all tnodes are now implemented
     * Moved pocall_internconst to po_internconst because it is not a
       calling type at all and it conflicted when inlining of these small

+ 24 - 20
compiler/pexpr.pas

@@ -317,7 +317,7 @@ implementation
                statement_syssym:=geninlinenode(in_sizeof_x,false,p1)
               else
                begin
-                 statement_syssym:=cordconstnode.create(p1.resulttype.def.size,s32bittype);
+                 statement_syssym:=cordconstnode.create(p1.resulttype.def.size,s32bittype,true);
                  { p1 not needed !}
                  p1.destroy;
                end;
@@ -741,7 +741,7 @@ implementation
                sl_subscript :
                  p1:=csubscriptnode.create(plist^.sym,p1);
                sl_vec :
-                 p1:=cvecnode.create(p1,cordconstnode.create(plist^.value,s32bittype));
+                 p1:=cvecnode.create(p1,cordconstnode.create(plist^.value,s32bittype,true));
                else
                  internalerror(200110205);
              end;
@@ -769,7 +769,7 @@ implementation
          { indexed property }
          if (ppo_indexed in tpropertysym(sym).propoptions) then
            begin
-              p2:=cordconstnode.create(tpropertysym(sym).index,tpropertysym(sym).indextype);
+              p2:=cordconstnode.create(tpropertysym(sym).index,tpropertysym(sym).indextype,true);
               paras:=ccallparanode.create(p2,paras);
            end;
          { we need only a write property if a := follows }
@@ -1179,12 +1179,12 @@ implementation
                           { do a very dirty trick to bootstrap this code }
                           if (tconstsym(srsym).valueord>=-(int64(2147483647)+int64(1))) and
                              (tconstsym(srsym).valueord<=2147483647) then
-                           p1:=cordconstnode.create(tconstsym(srsym).valueord,s32bittype)
+                           p1:=cordconstnode.create(tconstsym(srsym).valueord,s32bittype,true)
                           else if (tconstsym(srsym).valueord > maxlongint) and
                                   (tconstsym(srsym).valueord <= int64(maxlongint)+int64(maxlongint)+1) then
-                           p1:=cordconstnode.create(tconstsym(srsym).valueord,u32bittype)
+                           p1:=cordconstnode.create(tconstsym(srsym).valueord,u32bittype,true)
                           else
-                           p1:=cordconstnode.create(tconstsym(srsym).valueord,cs64bittype);
+                           p1:=cordconstnode.create(tconstsym(srsym).valueord,cs64bittype,true);
                         end;
                       conststring :
                         begin
@@ -1197,15 +1197,15 @@ implementation
                           p1:=cstringconstnode.createpchar(pc,len);
                         end;
                       constchar :
-                        p1:=cordconstnode.create(tconstsym(srsym).valueord,cchartype);
+                        p1:=cordconstnode.create(tconstsym(srsym).valueord,cchartype,true);
                       constreal :
                         p1:=crealconstnode.create(pbestreal(tconstsym(srsym).valueptr)^,pbestrealtype^);
                       constbool :
-                        p1:=cordconstnode.create(tconstsym(srsym).valueord,booltype);
+                        p1:=cordconstnode.create(tconstsym(srsym).valueord,booltype,true);
                       constset :
                         p1:=csetconstnode.create(pconstset(tconstsym(srsym).valueptr),tconstsym(srsym).consttype);
                       constord :
-                        p1:=cordconstnode.create(tconstsym(srsym).valueord,tconstsym(srsym).consttype);
+                        p1:=cordconstnode.create(tconstsym(srsym).valueord,tconstsym(srsym).consttype,true);
                       constpointer :
                         p1:=cpointerconstnode.create(tconstsym(srsym).valueordptr,tconstsym(srsym).consttype);
                       constnil :
@@ -1468,7 +1468,7 @@ implementation
                                     if (token=_COLON) then
                                      begin
                                        consume(_COLON);
-                                       p3:=caddnode.create(muln,cordconstnode.create($10,s32bittype),p2);
+                                       p3:=caddnode.create(muln,cordconstnode.create($10,s32bittype,false),p2);
                                        p2:=comp_expr(true);
                                        p2:=caddnode.create(addn,p2,p3);
                                        p1:=cvecnode.create(p1,p2);
@@ -1784,7 +1784,7 @@ implementation
                                 Message(cg_e_invalid_integer);
                                 consume(_INTCONST);
                                 l:=1;
-                                p1:=cordconstnode.create(l,s32bittype);
+                                p1:=cordconstnode.create(l,s32bittype,true);
                              end
                             else
                              begin
@@ -1795,13 +1795,13 @@ implementation
                        else
                          begin
                             consume(_INTCONST);
-                            p1:=cordconstnode.create(ic,cs64bittype);
+                            p1:=cordconstnode.create(ic,cs64bittype,true);
                          end
                      end
                    else
                      begin
                        consume(_INTCONST);
-                       p1:=cordconstnode.create(l,s32bittype)
+                       p1:=cordconstnode.create(l,s32bittype,true)
                      end
                  end
                else
@@ -1811,9 +1811,9 @@ implementation
                    { (longint is easier to perform calculations with) (JM)      }
                    if card <= $7fffffff then
                      { no sign extension necessary, so not longint typecast (JM) }
-                     p1:=cordconstnode.create(card,s32bittype)
+                     p1:=cordconstnode.create(card,s32bittype,true)
                    else
-                     p1:=cordconstnode.create(card,u32bittype)
+                     p1:=cordconstnode.create(card,u32bittype,true)
                 end;
              end;
 
@@ -1878,7 +1878,7 @@ implementation
 
            _CCHAR :
              begin
-               p1:=cordconstnode.create(ord(pattern[1]),cchartype);
+               p1:=cordconstnode.create(ord(pattern[1]),cchartype,true);
                consume(_CCHAR);
              end;
 
@@ -1890,7 +1890,7 @@ implementation
 
            _CWCHAR:
              begin
-               p1:=cordconstnode.create(ord(getcharwidestring(patternw,0)),cwidechartype);
+               p1:=cordconstnode.create(ord(getcharwidestring(patternw,0)),cwidechartype,true);
                consume(_CWCHAR);
              end;
 
@@ -1967,13 +1967,13 @@ implementation
            _TRUE :
              begin
                consume(_TRUE);
-               p1:=cordconstnode.create(1,booltype);
+               p1:=cordconstnode.create(1,booltype,false);
              end;
 
            _FALSE :
              begin
                consume(_FALSE);
-               p1:=cordconstnode.create(0,booltype);
+               p1:=cordconstnode.create(0,booltype,false);
              end;
 
            _NIL :
@@ -2248,7 +2248,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.78  2002-09-03 16:26:27  daniel
+  Revision 1.79  2002-09-07 12:16:03  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.78  2002/09/03 16:26:27  daniel
     * Make Tprocdef.defs protected
 
   Revision 1.77  2002/08/18 20:06:24  peter

+ 9 - 5
compiler/pinline.pas

@@ -221,7 +221,7 @@ implementation
 
                      { create call to fpc_getmem }
                      para := ccallparanode.create(cordconstnode.create
-                         (tpointerdef(p.resulttype.def).pointertype.def.size,s32bittype),nil);
+                         (tpointerdef(p.resulttype.def).pointertype.def.size,s32bittype,true),nil);
                      addstatement(newstatement,cassignmentnode.create(
                          ctemprefnode.create(temp),
                          ccallnode.createintern('fpc_getmem',para)));
@@ -305,7 +305,7 @@ implementation
 
             { create call to fpc_getmem }
             para := ccallparanode.create(cordconstnode.create
-                (tpointerdef(p1.resulttype.def).pointertype.def.size,s32bittype),nil);
+                (tpointerdef(p1.resulttype.def).pointertype.def.size,s32bittype,true),nil);
             addstatement(newstatement,cassignmentnode.create(
                 ctemprefnode.create(temp),
                 ccallnode.createintern('fpc_getmem',para)));
@@ -480,7 +480,7 @@ implementation
             npara:=ccallparanode.create(caddrnode.create
                       (ctemprefnode.create(temp)),
                    ccallparanode.create(cordconstnode.create
-                      (counter,s32bittype),
+                      (counter,s32bittype,true),
                    ccallparanode.create(caddrnode.create
                       (crttinode.create(tstoreddef(destppn.resulttype.def),initrtti)),
                    ccallparanode.create(ctypeconvnode.create_explicit(destppn,voidpointertype),nil))));
@@ -536,7 +536,7 @@ implementation
             end;
            { create call to fpc_finalize_array }
            npara:=ccallparanode.create(cordconstnode.create
-                     (destppn.left.resulttype.def.size,s32bittype),
+                     (destppn.left.resulttype.def.size,s32bittype,true),
                   ccallparanode.create(ctypeconvnode.create
                      (ppn.left,s32bittype),
                   ccallparanode.create(caddrnode.create
@@ -565,7 +565,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.6  2002-07-20 11:57:56  florian
+  Revision 1.7  2002-09-07 12:16:03  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.6  2002/07/20 11:57:56  florian
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added

+ 6 - 2
compiler/pstatmnt.pas

@@ -196,7 +196,7 @@ implementation
             CGMessage(type_e_ordinal_expr_expected);
             { create a correct tree }
             caseexpr.free;
-            caseexpr:=cordconstnode.create(0,u32bittype);
+            caseexpr:=cordconstnode.create(0,u32bittype,false);
             { set error flag so no rangechecks are done }
             casedeferror:=true;
           end;
@@ -1146,7 +1146,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.75  2002-09-02 18:40:52  peter
+  Revision 1.76  2002-09-07 12:16:03  carl
+    * second part bug report 1996 fix, testrange in cordconstnode
+      only called if option is set (also make parsing a tiny faster)
+
+  Revision 1.75  2002/09/02 18:40:52  peter
     * fixed parsing of register names with lowercase
 
   Revision 1.74  2002/09/01 14:43:12  peter