This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: java -vs- some FP constants


Currently gcj will reject a floating point constant with leading
zeros.  It does this because it thinks that the constant must be
octal, which is invalid.

This trivial patch fixes this problem.  I've rebuilt libgcj with it
with no problems.  This patch lets us pass another Jacks test.

Ok to commit?

2000-11-20  Tom Tromey  <tromey@cygnus.com>

	* lex.c (yylex): Recognize floating point constants with leading
	0.

Tom

Index: lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/lex.c,v
retrieving revision 1.52
diff -u -r1.52 lex.c
--- lex.c	2000/11/07 22:50:06	1.52
+++ lex.c	2000/11/20 21:33:45
@@ -1024,8 +1064,12 @@
 	  int seen_exponent = 0;
 	  int fflag = 0;	/* 1 for {f,F}, 0 for {d,D}. FP literal are
 				   double unless specified. */
-	  if (radix != 10)
+
+	  /* It is ok if the radix is 8 because this just means we've
+	     seen a leading `0'.  However, radix==16 is invalid.  */
+	  if (radix == 16)
 	    java_lex_error ("Can't express non-decimal FP literal", 0);
+	  radix = 10;
 
 	  for (;;)
 	    {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]