aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-12-05 11:56:20 +0000
committerJohn Gilmore <gnu@cygnus>1991-12-05 11:56:20 +0000
commit2a5ec41d888f9f6004f237670e676ea5617f281e (patch)
tree50ebecce00b9c431f91c988785bf39faa2753bc9 /gdb/c-exp.y
parent98618bf78adc8b432655d41f088e66556538e5df (diff)
downloadgdb-2a5ec41d888f9f6004f237670e676ea5617f281e.zip
gdb-2a5ec41d888f9f6004f237670e676ea5617f281e.tar.gz
gdb-2a5ec41d888f9f6004f237670e676ea5617f281e.tar.bz2
Fix things pointed up by Fred Fish's test suite; see ChangeLog.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 192ed47..7d4b177 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -977,10 +977,11 @@ parse_number (p, len, parsed_float, putithere)
}
if (i >= base)
return ERROR; /* Invalid digit in this base */
- if(!unsigned_p && (prevn >= n))
+ /* Portably test for overflow (only works for nonzero values, so make
+ a second check for zero). */
+ if((prevn >= n) && n != 0)
unsigned_p=1; /* Try something unsigned */
- /* Don't do the range check if n==i and i==0, since that special
- case will give an overflow error. */
+ /* If range checking enabled, portably test for unsigned overflow. */
if(RANGE_CHECK && n!=0)
{
if((unsigned_p && (unsigned)prevn >= (unsigned)n))