From 93a3661e3fb02276b3ccc27db7ede68f708bd306 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 21 Aug 2006 12:55:28 +0000 Subject: [PATCH] BugFix: - get_tarval_overflow(): when in warp mode, the strcalc module expects that ALL bits are set (and this includes the HIGH bits) [r8132] --- ir/tv/strcalc.c | 2 +- ir/tv/strcalc.h | 2 ++ ir/tv/tv.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ir/tv/strcalc.c b/ir/tv/strcalc.c index b23b0ece1..dd2e6a3f2 100644 --- a/ir/tv/strcalc.c +++ b/ir/tv/strcalc.c @@ -963,7 +963,7 @@ int sc_get_buffer_length(void) * Do sign extension if the mode is signed, expects all upper bits * cleared. */ -static void sign_extend(char *calc_buffer, ir_mode *mode) { +void sign_extend(char *calc_buffer, ir_mode *mode) { if (mode_is_signed(mode)) { int bits = get_mode_size_bits(mode) - 1; int ofs = bits >> 2; diff --git a/ir/tv/strcalc.h b/ir/tv/strcalc.h index 0adf44511..fbb92874a 100644 --- a/ir/tv/strcalc.h +++ b/ir/tv/strcalc.h @@ -120,6 +120,8 @@ enum base_t { const void *sc_get_buffer(void); int sc_get_buffer_length(void); +void sign_extend(char *calc_buffer, ir_mode *mode); + /** create an value form a string representation */ void sc_val_from_str(const char *str, unsigned int len, void *buffer, ir_mode *mode); diff --git a/ir/tv/tv.c b/ir/tv/tv.c index bb4eab12f..9ccdbad1c 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -194,6 +194,8 @@ static tarval *get_tarval_overflow(const void *value, int length, ir_mode *mode) char *temp = alloca(sc_get_buffer_length()); sc_val_from_ulong(-1, temp); sc_and(temp, value, temp); + /* the sc_ module expects that all bits are set ... */ + sign_extend(temp, mode); return get_tarval(temp, length, mode); } case TV_OVERFLOW_BAD: -- 2.20.1