This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix C side of 11926 for 7.2


Hi.

I committed this to the 7.2 branch.
It's a reduced version of the patch for 11926.

2010-08-19  Doug Evans  <dje@google.com>

	PR exp/11926
	* c-exp.y (parse_number): Handle 0 return from sscanf.

	testsuite/
	* gdb.base/printcmds.exp (test_integer_literals_rejected): Add
	test of "p 0x1.1".

Index: c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.76
diff -u -p -r1.76 c-exp.y
--- c-exp.y	28 Jun 2010 20:18:26 -0000	1.76
+++ c-exp.y	19 Aug 2010 15:46:24 -0000
@@ -1371,6 +1371,12 @@ parse_number (char *p, int len, int pars
 		    &putithere->typed_val_float.dval, s);
       p[len] = saved_char;	/* restore the input stream */
 
+      if (num == 0)
+	{
+	  free (s);
+	  return ERROR;
+	}
+
       if (num == 1)
 	putithere->typed_val_float.type = 
 	  parse_type->builtin_double;
Index: testsuite/gdb.base/printcmds.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v
retrieving revision 1.34.2.1
diff -u -p -r1.34.2.1 printcmds.exp
--- testsuite/gdb.base/printcmds.exp	21 Jul 2010 18:01:22 -0000	1.34.2.1
+++ testsuite/gdb.base/printcmds.exp	19 Aug 2010 15:46:24 -0000
@@ -128,6 +128,7 @@ proc test_integer_literals_rejected {} {
     test_print_reject "p 123DEADBEEF"
     test_print_reject "p 123foobar.bazfoo3"
     test_print_reject "p 123EEEEEEEEEEEEEEEEE33333k333"
+    test_print_reject "p 0x1.1"
     gdb_test "p 123.4+56.7" "180.(099\[0-9]*|100\[0-9\]*)" "check for floating addition"
 
     # Test various octal values.


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