public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* egcs, fold-const.c warning fixes
@ 1998-02-17 13:54 Kaveh R. Ghazi
  1998-02-18  1:53 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-17 13:54 UTC (permalink / raw)
  To: law; +Cc: egcs

	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  <ghazi@caip.rutgers.edu>

        * 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 <stdio.h>
+#include "system.h"
 #include <setjmp.h>
 #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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: egcs, fold-const.c warning fixes
  1998-02-17 13:54 egcs, fold-const.c warning fixes Kaveh R. Ghazi
@ 1998-02-18  1:53 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-02-18  1:53 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs

  In message < 199802171746.MAA28296@caip.rutgers.edu >you write:
  > Mon Feb 16 16:04:53 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  > 
  >         * 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.
I installed most of this -- except for the "Initialize variables ...";
I'm going to try and test the new scheme for detecting this situation
in the next day or two.  Hopefully it'll work better and we can avoid
hacking up the sources to work around bugs in the compiler's life
analysis code :-)

jeff


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-02-18  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-17 13:54 egcs, fold-const.c warning fixes Kaveh R. Ghazi
1998-02-18  1:53 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).