summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--testsuite/ChangeLog5
-rwxr-xr-xtestsuite/buildok/ten.stp5
-rw-r--r--translate.cxx29
4 files changed, 41 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index c61370f6..3afbbfb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
+2007-09-12 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 5023
+ * translate.cxx (c_unparser::visit_literal_number): Support LLONG_MIN.
+ (visit_unary_expression): Likewise.
+
2007-09-12 Martin Hunt <hunt@redhat.com>
+
PR 5019
* elaborate.cxx (visit_hist_op): Remove log histogram param.
* translate.cxx (assert_hist_compatible): Ditto.
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index faa6322c..67940812 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-12 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 5023.
+ * buildok/ten.stp: Extend some more.
+
2007-09-12 Martin Hunt <hunt@redhat.com>
* systemtap.maps/foreach_limit.stp: Clean up the aggregates
diff --git a/testsuite/buildok/ten.stp b/testsuite/buildok/ten.stp
index dfa1e5ac..cd94645a 100755
--- a/testsuite/buildok/ten.stp
+++ b/testsuite/buildok/ten.stp
@@ -13,4 +13,9 @@ probe begin
ullong_max = 18446744073709551615;
llong_min = -9223372036854775807-1;
llong_min2 = -9223372036854775808;
+ llong_min3 = 9223372036854775808;
+
+ // nearly out-of-range negative numbers
+ underflow_1 = -9223372036854775809;
+ underflow_2 = -18446744073709551615;
}
diff --git a/translate.cxx b/translate.cxx
index 96d4d62b..c60fad97 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -1794,7 +1794,7 @@ c_unparser::c_expression (expression *e)
// have the same value as being visited by c_unparser. For
// instance, a numeric constant evaluated using print() would return
// "5", while c_unparser::visit_literal_number() would
- // return "((int64_t)5LL)". String constants evalutated using
+ // return "((int64_t)5LL)". String constants evaluated using
// print() would just return the string, while
// c_unparser::visit_literal_string() would return the string with
// escaped double quote characters. So, we need to "visit" the
@@ -2860,7 +2860,10 @@ c_unparser::visit_literal_number (literal_number* e)
// This looks ugly, but tries to be warning-free on 32- and 64-bit
// hosts.
// NB: this needs to be signed!
- o->line() << "((int64_t)" << e->value << "LL)";
+ if (e->value == -9223372036854775807LL-1) // PR 5023
+ o->line() << "((int64_t)" << (unsigned long long) e->value << "ULL)";
+ else
+ o->line() << "((int64_t)" << e->value << "LL)";
}
@@ -2958,9 +2961,25 @@ c_unparser::visit_unary_expression (unary_expression* e)
e->operand->type != pe_long)
throw semantic_error ("expected numeric types", e->tok);
- o->line() << "(" << e->op << " (";
- e->operand->visit (this);
- o->line() << "))";
+ if (e->op == "-")
+ {
+ // NB: Subtraction is special, since negative literals in the
+ // script language show up as unary negations over positive
+ // literals here. This makes it "exciting" for emitting pure
+ // C since: - 0x8000_0000_0000_0000 ==> - (- 9223372036854775808)
+ // This would constitute a signed overflow, which gcc warns on
+ // unless -ftrapv/-J are in CFLAGS - which they're not.
+
+ o->line() << "(int64_t)(0 " << e->op << " (uint64_t)(";
+ e->operand->visit (this);
+ o->line() << "))";
+ }
+ else
+ {
+ o->line() << "(" << e->op << " (";
+ e->operand->visit (this);
+ o->line() << "))";
+ }
}
void