dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_cast.tc,1.9,1.10 cs_oper


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_cast.tc,1.9,1.10 cs_oper.tc,1.42,1.43
Date: Sat, 05 Jul 2003 01:04:01 -0400

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv11152/cscc/csharp

Modified Files:
        cs_cast.tc cs_oper.tc 
Log Message:


Fix bug #4197 - "unchecked" is required for numeric constant
casts such as "uint" to "int".


Index: cs_cast.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_cast.tc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** cs_cast.tc  5 Jun 2003 01:07:17 -0000       1.9
--- cs_cast.tc  5 Jul 2003 05:03:58 -0000       1.10
***************
*** 83,86 ****
--- 83,105 ----
        if(ILNode_EvalConst(*parent, info, &evalValue))
        {
+               if(!(info->overflowInsns) && !(info->overflowChanged))
+               {
+                       /* Re-evaluate in overflow mode to see if an explicit
+                          "unchecked(x)" is required around the expression */
+                       ILEvalValue evalValue2;
+                       int result;
+                       info->overflowInsns = 1;
+                       info->overflowChanged = 1;
+                       result = ILNode_EvalConst(*parent, info, &evalValue2);
+                       info->overflowInsns = 0;
+                       info->overflowChanged = 0;
+                       if(!result)
+                       {
+                               CCErrorOnLine(yygetfilename(node), 
yygetlinenum(node),
+                                                         "constant value 
cannot be converted to `%s' "
+                                                         "without an explicit 
`unchecked' context",
+                                                         
CSTypeToName(CSSemGetType(type)));
+                       }
+               }
                CSSemSetConstant(value, CSSemGetType(type), evalValue);
                CSSemReplaceWithConstant(parent, value);

Index: cs_oper.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_oper.tc,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** cs_oper.tc  30 May 2003 03:59:41 -0000      1.42
--- cs_oper.tc  5 Jul 2003 05:03:58 -0000       1.43
***************
*** 2258,2264 ****
--- 2258,2267 ----
        CSSemValue value;
        int overflow = info->overflowInsns;
+       int changed = info->overflowChanged;
        info->overflowInsns = 1;
+       info->overflowChanged = 1;
        value = ILNode_SemAnalysis(node->expr, info, &(node->expr));
        info->overflowInsns = overflow;
+       info->overflowChanged = changed;
        return value;
  }
***************
*** 2271,2277 ****
--- 2274,2283 ----
        CSSemValue value;
        int overflow = info->overflowInsns;
+       int changed = info->overflowChanged;
        info->overflowInsns = 0;
+       info->overflowChanged = 1;
        value = ILNode_SemAnalysis(node->expr, info, &(node->expr));
        info->overflowInsns = overflow;
+       info->overflowChanged = changed;
        return value;
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]