BugFix:
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 21 Aug 2006 12:55:28 +0000 (12:55 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 21 Aug 2006 12:55:28 +0000 (12:55 +0000)
- 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
ir/tv/strcalc.h
ir/tv/tv.c

index b23b0ec..dd2e6a3 100644 (file)
@@ -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;
index 0adf445..fbb9287 100644 (file)
@@ -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);
 
index bb4eab1..9ccdbad 100644 (file)
@@ -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: