copy_entity_own(): assert if the new type has already a fixed layout
[libfirm] / ir / tv / fltcalc.c
index bed4dac..564b28c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -1063,6 +1063,9 @@ fp_value *fc_val_from_ieee754(LLDBL l, char exp_size, char mant_size, fp_value *
        if (result == NULL) result = calc_buffer;
        temp = alloca(value_size);
 
+       /* CLEAR the buffer */
+       memset(result, 0, fc_get_buffer_length());
+
        result->desc.exponent_size = exp_size;
        result->desc.mantissa_size = mant_size;
 
@@ -1627,6 +1630,7 @@ fp_value *fc_int(const fp_value *a, fp_value *result) {
 fp_value *fc_rnd(const fp_value *a, fp_value *result) {
        if (result == NULL) result = calc_buffer;
 
+       (void) a;
        TRACEPRINTF(("%s ", fc_print(a, buffer, sizeof(buffer), FC_PACKED)));
        TRACEPRINTF(("rounded to integer "));
 
@@ -1665,18 +1669,18 @@ int fc_flt2int(const fp_value *a, void *result, ir_mode *dst_mode) {
                if (mode_is_signed(dst_mode)) {
                        if (highest == sc_get_lowest_set_bit(result)) {
                                /* need extra test for MIN_INT */
-                               if (highest >= get_mode_size_bits(dst_mode)) {
+                               if (highest >= (int) get_mode_size_bits(dst_mode)) {
                                        /* FIXME: handle overflow */
                                        return 0;
                                }
                        } else {
-                               if (highest >= get_mode_size_bits(dst_mode) - 1) {
+                               if (highest >= (int) get_mode_size_bits(dst_mode) - 1) {
                                        /* FIXME: handle overflow */
                                        return 0;
                                }
                        }
                } else {
-                       if (highest >= get_mode_size_bits(dst_mode)) {
+                       if (highest >= (int) get_mode_size_bits(dst_mode)) {
                                /* FIXME: handle overflow */
                                return 0;
                        }