public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit] Fix C side of 11926 for 7.2
@ 2010-08-19 15:53 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2010-08-19 15:53 UTC (permalink / raw)
  To: gdb-patches

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-19 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-19 15:53 [commit] Fix C side of 11926 for 7.2 Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).