This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFA] Avoid warnings in compiling final.c


Hi,

There are some warnings which prevents bootstrap without --disable-werror
on sh4-unknown-linux-gnu.  All of them except the warnings below are SH
specific:

stage1/xgcc -Bstage1/ -B/usr/gnu/sh4-unknown-linux-gnu/bin/ -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition     -DHAVE_CONFIG_H  -I. -I. -I../../TMP/gcc/gcc -I../../TMP/gcc/gcc/. -I../../TMP/gcc/gcc/../include -I../../TMP/gcc/gcc/../libcpp/include  ../../TMP/gcc/gcc/final.c -o final.o
../../TMP/gcc/gcc/final.c: In function 'shorten_branches':
../../TMP/gcc/gcc/final.c:965: warning: 'flags$scale' is used uninitialized in this function
../../TMP/gcc/gcc/final.c:965: warning: 'flags$D8619' is used uninitialized in this function
../../TMP/gcc/gcc/final.c:965: warning: 'flags$offset_unsigned' is used uninitialized in this function
s

The appended patch is to avoid the above warnings.  it bootstraps
on sh4-unknown-linux-gnu without new regressions.  It also tested
on i686-pc-linux-gnu, though the code in problem is wrapped with
#ifdef CASE_VECTOR_SHORTEN_MODE and this macro looks defined only
with SH port.

Regards,
	kaz
--
2004-10-26  Kaz Kojima  <kkojima@gcc.gnu.org>

	* final.c (shorten_branches): Initialize flags structure.

diff -uprN ORIG/gcc/gcc/final.c TMP/gcc/gcc/final.c
--- ORIG/gcc/gcc/final.c	2004-10-25 16:59:19.000000000 +0900
+++ TMP/gcc/gcc/final.c	2004-10-26 09:28:02.000000000 +0900
@@ -956,6 +956,7 @@ shorten_branches (rtx first ATTRIBUTE_UN
 	  XEXP (pat, 3) = gen_rtx_LABEL_REF (VOIDmode, max_lab);
 	  insn_shuid = INSN_SHUID (insn);
 	  rel = INSN_SHUID (XEXP (XEXP (pat, 0), 0));
+	  memset (&flags, 0, sizeof (flags));
 	  flags.min_align = min_align;
 	  flags.base_after_vec = rel > insn_shuid;
 	  flags.min_after_vec  = min > insn_shuid;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]