From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Kaveh R. Ghazi" To: law@cygnus.com Cc: egcs@cygnus.com Subject: egcs, fold-const.c warning fixes Date: Tue, 17 Feb 1998 13:54:00 -0000 Message-id: <199802171746.MAA28296@caip.rutgers.edu> X-SW-Source: 1998-02/msg00828.html This one fixes warnings in fold-const.c. Please double check the parentheses I added around arithmetic inside shifts. thanks, --Kaveh Mon Feb 16 16:04:53 1998 Kaveh R. Ghazi * fold-const.c: Include "system.h" to get stdlib.h and stdio.h. (lshift_double): Add parentheses around + or - inside shift. (rshift_double): Likewise. (size_int_wide): Explicitly set type of `bit_p' to `int'. (optimize_bit_field_compare): Initialize variables `rnbitpos' and `rnbitsize' to 0, and `rinner' to NULL_TREE. (make_range): Initialize variable `type' to NULL_TREE. (fold): Initialize variables `arg0', `arg1' and `varop' to NULL_TREE. * Makefile.in (fold-const.o): Depend on system.h. --- gcc/Makefile.in~ Wed Feb 11 17:26:23 1998 +++ gcc/Makefile.in Tue Feb 17 11:40:13 1998 @@ -1318,7 +1318,7 @@ tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H) stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h -fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h +fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h system.h toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) \ flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \ $(lang_options_files) --- gcc/fold-const.c~ Mon Feb 16 15:51:21 1998 +++ gcc/fold-const.c Mon Feb 16 15:51:19 1998 @@ -43,7 +43,7 @@ forces the value to fit the type. It returns an overflow indicator. */ #include "config.h" -#include +#include "system.h" #include #include "flags.h" #include "tree.h" @@ -356,13 +356,13 @@ if (count >= HOST_BITS_PER_WIDE_INT) { - *hv = (unsigned HOST_WIDE_INT) l1 << count - HOST_BITS_PER_WIDE_INT; + *hv = (unsigned HOST_WIDE_INT) l1 << (count - HOST_BITS_PER_WIDE_INT); *lv = 0; } else { *hv = (((unsigned HOST_WIDE_INT) h1 << count) - | ((unsigned HOST_WIDE_INT) l1 >> HOST_BITS_PER_WIDE_INT - count - 1 >> 1)); + | ((unsigned HOST_WIDE_INT) l1 >> (HOST_BITS_PER_WIDE_INT - count - 1) >> 1)); *lv = (unsigned HOST_WIDE_INT) l1 << count; } } @@ -392,14 +392,14 @@ if (count >= HOST_BITS_PER_WIDE_INT) { *hv = signmask; - *lv = ((signmask << 2 * HOST_BITS_PER_WIDE_INT - count - 1 << 1) - | ((unsigned HOST_WIDE_INT) h1 >> count - HOST_BITS_PER_WIDE_INT)); + *lv = ((signmask << (2 * HOST_BITS_PER_WIDE_INT - count - 1) << 1) + | ((unsigned HOST_WIDE_INT) h1 >> (count - HOST_BITS_PER_WIDE_INT))); } else { *lv = (((unsigned HOST_WIDE_INT) l1 >> count) - | ((unsigned HOST_WIDE_INT) h1 << HOST_BITS_PER_WIDE_INT - count - 1 << 1)); - *hv = ((signmask << HOST_BITS_PER_WIDE_INT - count) + | ((unsigned HOST_WIDE_INT) h1 << (HOST_BITS_PER_WIDE_INT - count - 1) << 1)); + *hv = ((signmask << (HOST_BITS_PER_WIDE_INT - count)) | ((unsigned HOST_WIDE_INT) h1 >> count)); } } @@ -1429,6 +1429,7 @@ tree size_int_wide (number, high, bit_p) unsigned HOST_WIDE_INT number, high; + int bit_p; { register tree t; /* Type-size nodes already made for small sizes. */ @@ -2379,7 +2380,7 @@ tree lhs, rhs; { int lbitpos, lbitsize, rbitpos, rbitsize; - int lnbitpos, lnbitsize, rnbitpos, rnbitsize; + int lnbitpos, lnbitsize, rnbitpos = 0, rnbitsize = 0; tree type = TREE_TYPE (lhs); tree signed_type, unsigned_type; int const_p = TREE_CODE (rhs) == INTEGER_CST; @@ -2387,7 +2388,7 @@ int lunsignedp, runsignedp; int lvolatilep = 0, rvolatilep = 0; int alignment; - tree linner, rinner; + tree linner, rinner = NULL_TREE; tree mask; tree offset; @@ -2775,7 +2776,7 @@ tree *plow, *phigh; { enum tree_code code; - tree arg0, arg1, type; + tree arg0, arg1, type = NULL_TREE; int in_p, n_in_p; tree low, high, n_low, n_high; @@ -3707,7 +3708,7 @@ tree t1 = NULL_TREE; tree tem; tree type = TREE_TYPE (expr); - register tree arg0, arg1; + register tree arg0 = NULL_TREE, arg1 = NULL_TREE; register enum tree_code code = TREE_CODE (t); register int kind; int invert; @@ -5097,7 +5098,7 @@ First, see if one arg is constant; find the constant arg and the other one. */ { - tree constop = 0, varop; + tree constop = 0, varop = NULL_TREE; int constopnum = -1; if (TREE_CONSTANT (arg1)) -- Kaveh R. Ghazi Project Manager / Custom Development ghazi@caip.rutgers.edu ICon CMT Corp.