aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
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))