summaryrefslogtreecommitdiffstats
path: root/libcpp
diff options
context:
space:
mode:
authorechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-02 21:57:50 +0000
committerechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-02 21:57:50 +0000
commitdd97b5e44d5287ad62c24e81cd2c3ee8a8b954b0 (patch)
tree96d3589306464ba40e11a61ae06c3e1fdccbd38f /libcpp
parent3127c3578f232a6b59c622134694c64a00c7f6e9 (diff)
downloadppe42-gcc-dd97b5e44d5287ad62c24e81cd2c3ee8a8b954b0.tar.gz
ppe42-gcc-dd97b5e44d5287ad62c24e81cd2c3ee8a8b954b0.zip
2007-05-02 Eric Christopher <echristo@apple.com>
* gcc.dg/cpp/if-div.c: New file. 2007-05-02 Eric Christopher <echristo@apple.com> * expr.c (num_div_op): Don't overflow if the result is zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124358 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/expr.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 0193de47cf3..cc5a71692c7 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-02 Eric Christopher <echristo@apple.com>
+
+ * expr.c (num_div_op): Don't overflow if the result is
+ zero.
+
2007-05-02 Tom Tromey <tromey@redhat.com>
PR preprocessor/28709:
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 574b85ff656..a00614026c2 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -91,7 +91,7 @@ interpret_float_suffix (const uchar *s, size_t len)
case 'l': case 'L': l++; break;
case 'i': case 'I':
case 'j': case 'J': i++; break;
- case 'd': case 'D':
+ case 'd': case 'D':
/* Disallow fd, ld suffixes. */
if (d && (f || l))
return 0;
@@ -441,7 +441,7 @@ append_digit (cpp_num num, int digit, int base, size_t precision)
if (add_low + digit < add_low)
add_high++;
add_low += digit;
-
+
if (result.low + add_low < result.low)
add_high++;
if (result.high + add_high < result.high)
@@ -1527,7 +1527,8 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
{
if (negate)
result = num_negate (result, precision);
- result.overflow = num_positive (result, precision) ^ !negate;
+ result.overflow = (num_positive (result, precision) ^ !negate
+ && !num_zerop (result));
}
return result;
OpenPOWER on IntegriCloud