[Mono-bugs] [Bug 51427][Wis] New - MCS does not handle long a = 0x07FFFFFFFFFFFFFFFL;

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 26 Nov 2003 16:11:27 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=51427

--- shadow/51427	2003-11-26 16:11:27.000000000 -0500
+++ shadow/51427.tmp.31186	2003-11-26 16:11:27.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 51427
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 001 One hour
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS does not handle long a = 0x07FFFFFFFFFFFFFFFL;
+
+class t {
+	static void Main () {
+		long a = 0x07FFFFFFFFFFFFFFFL;
+	}
+}
+
+Actual Results:
+t.cs(3) error CS1021: Integral constant too large
+syntax error, expecting BASE BOOL BYTE CHAR CHECKED DECIMAL DELEGATE DOUBLE
+FALSE FLOAT INT LONG NEW NULL OBJECT SBYTE SHORT SIZEOF STACKALLOC STRING
+THIS TRUE TYPEOF UINT ULONG UNCHECKED USHORT VOID OPEN_BRACE OPEN_PARENS
+TILDE PLUS MINUS BANG BITWISE_AND STAR OP_INC OP_DEC LITERAL_INTEGER
+LITERAL_FLOAT LITERAL_DOUBLE LITERAL_DECIMAL LITERAL_CHARACTER
+LITERAL_STRING IDENTIFIER
+t.cs(3) error CS1002: Expecting `;'
+Compilation failed: 2 error(s), 0 warnings
+[benm@Ben tmp]$ mcs t.cs
+Compilation succeeded
+
+
+Expected Results:
+Compiles
+
+Additional Information:
+in cs-tokenizer.cs there is this code:
+
+			while ((d = peekChar ()) != -1){
+				if (is_hex (d)){
+					if (number_pos == 16){
+						Report.Error (1021, Location, "Integral constant too large");
+						return Token.ERROR;
+					}
+					number_builder [number_pos++] = (char) d;
+					getChar ();
+				} else
+					break;
+			}
+
+This is incorrect, as shown in this example, CSC handles constants that are
+longer than 16 hex digits if they have leading 0's.