squeezing for MINIX & bug fix in dumpidf
authoreck <none@none>
Thu, 19 Jul 1990 17:16:36 +0000 (17:16 +0000)
committereck <none@none>
Thu, 19 Jul 1990 17:16:36 +0000 (17:16 +0000)
lang/cem/cemcom.ansi/arith.c
lang/cem/cemcom.ansi/atw.h
lang/cem/cemcom.ansi/dumpidf.c
lang/cem/cemcom.ansi/eval.c
lang/cem/cemcom.ansi/field.c
lang/cem/cemcom.ansi/label.c

index 08c1464..b327630 100644 (file)
@@ -364,7 +364,7 @@ int2float(expp, tp)
                converted to the floating type tp.
        */
        register struct expr *exp = *expp;
-       int uns = (*expp)->ex_type->tp_unsigned;
+       int uns = exp->ex_type->tp_unsigned;
        
        if (is_cp_cst(exp)) {
                *expp = new_expr();
@@ -596,19 +596,19 @@ field2arith(expp)
        (*expp)->ex_type = word_type;
 
        if (tp->tp_unsigned)    {       /* don't worry about the sign bit */
-               if (fd->fd_width >= 8 * word_size)
+               if (fd->fd_width >= 8 * (int)word_size)
                        (*expp)->ex_type = uword_type;
                ch3bin(expp, RIGHT, intexpr((arith)fd->fd_shift, INT));
                ch3bin(expp, '&', intexpr(fd->fd_mask, INT));
        }
        else    {       /* take care of the sign bit: sign extend if needed */
-               arith bits_in_type = word_size * 8;
+               arith other_bits = (int)word_size * 8 - fd->fd_width;
 
                ch3bin(expp, LEFT,
-                       intexpr(bits_in_type - fd->fd_width - fd->fd_shift,
+                       intexpr(other_bits - fd->fd_shift,
                                                INT)
                );
-               ch3bin(expp, RIGHT, intexpr(bits_in_type - fd->fd_width, INT));
+               ch3bin(expp, RIGHT, intexpr(other_bits, INT));
        }
 }
 #endif NOBITFIELD
index ed2b2dc..b631298 100644 (file)
@@ -7,4 +7,8 @@
 
 #include "sizes.h"
 
-#define        ATW(arg)        ((((arg) + word_size - 1) / word_size) * word_size)
+#if word_size==2 || word_size==4
+#define        ATW(arg)        (((arg) + (word_size - 1)) & ~ (word_size - 1))
+#else
+#define        ATW(arg)        ((((arg) + ((int)word_size - 1)) / word_size) * word_size)
+#endif
index fc5ee22..2b185c1 100644 (file)
@@ -326,7 +326,7 @@ dump_type(tp)
                        ops = 0;
                        break;
                }
-               if (!ops) tp = tp->tp_up;
+               if (ops) tp = tp->tp_up;
        }
        dumplevel--;
 }
index 54134b2..e2d7752 100644 (file)
@@ -1019,10 +1019,10 @@ load_val(expr, rlval)
 load_cst(val, siz)
        arith val, siz;
 {
-       if (siz <= word_size)
+       if ((int)siz <= (int)word_size)
                C_loc(val);
        else
-       if (siz == dword_size)
+       if ((int)siz == (int)dword_size)
                C_ldc(val);
        else {
                label datlab;
index 9cef7b4..2c4edd2 100644 (file)
@@ -53,7 +53,7 @@ eval_field(expr, code)
        struct type *tp = leftop->ex_type->tp_up;
        arith tmpvar = 0;
        struct type *atype = ( tp->tp_unsigned
-                               && fd->fd_width >= 8 * word_size)
+                               && fd->fd_width >= 8 * (int)word_size)
                                    ? uword_type
                                    : word_type;
 
@@ -89,7 +89,7 @@ eval_field(expr, code)
                        C_and(word_size);
                }
                else {
-                       arith sft = word_size * 8 - fd->fd_width;
+                       arith sft = (int)word_size * 8 - fd->fd_width;
                        C_loc(sft - fd->fd_shift);
                        C_sli(word_size);
                        C_loc(sft);
@@ -118,7 +118,7 @@ eval_field(expr, code)
                        retrieval) is on top of stack.
                */
                if (tp->tp_unsigned == 0) {     /* sign extension */
-                       register arith shift = word_size * 8 - fd->fd_width;
+                       register arith shift = (int)word_size * 8 - fd->fd_width;
 
                        C_loc(shift);
                        C_sli(word_size);
index 112bd33..90b6a89 100644 (file)
@@ -23,9 +23,9 @@ enter_label(idf, defining)
                scope, i.e., on the lowest possible level.
                If defining, the label comes from a label statement.
        */
-       if (idf->id_def)        {
-               register struct def *def = idf->id_def;
-               
+       register struct def *def = idf->id_def;
+
+       if (def)        {
                if (def->df_sc == LABEL)        {
                        if (defining && def->df_initialized)
                                error("redeclaration of label %s",
@@ -41,11 +41,12 @@ enter_label(idf, defining)
        }
        else    {
                add_def(idf, LABEL, label_type, L_LOCAL);
+               def = idf->id_def;
        }
-       if (idf->id_def->df_address == 0)
-               idf->id_def->df_address = (arith) text_label();
+       if (def->df_address == 0)
+               def->df_address = (arith) text_label();
        if (defining)
-               idf->id_def->df_initialized = 1;
+               def->df_initialized = 1;
 }
 
 unstack_label(idf)