This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for uninitialized variable bug in m68hc11.md
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org, stcarrez at nerim dot fr
- Date: Mon, 16 Sep 2002 11:27:04 -0400 (EDT)
- Subject: Patch for uninitialized variable bug in m68hc11.md
I get this warning when cross-compiling to m68hc11-unknown-elf:
> insn-output.c:1107: warning: `val' might be used uninitialized in this function
This one is an actual bug due to a problem in m68hc11.md. The line in
question evaluates to:
val = (foo >= 0 && val < 0x100)
whereas for `val' to be initialized it should read:
(val = foo) >= 0 && val < 0x100
Tested by cross compiling cc1 to m68hc11-unknown-elf and verifying the
warning went away.
Ok to install on the trunk?
Thanks,
--Kaveh
2002-09-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* m68hc11.md (addhi_sp): Fix uninitialized variable bug.
diff -rup orig/egcc-CVS20020915/gcc/config/m68hc11/m68hc11.md egcc-CVS20020915/gcc/config/m68hc11/m68hc11.md
--- orig/egcc-CVS20020915/gcc/config/m68hc11/m68hc11.md 2002-09-14 15:24:45.000000000 -0400
+++ egcc-CVS20020915/gcc/config/m68hc11/m68hc11.md 2002-09-16 11:02:09.616241571 -0400
@@ -2258,7 +2258,7 @@
Register X/Y is lost, this is specified by the (clobber) statement. */
output_asm_insn (\"ts%3\", operands);
if (GET_CODE (operands[2]) == CONST_INT
- && ((val = INTVAL (operands[2]) >= 0 && val < 0x100))
+ && ((val = INTVAL (operands[2])) >= 0 && val < 0x100)
&& dead_register_here (insn, gen_rtx (REG, HImode, HARD_D_REGNUM)))
{
output_asm_insn (\"ldab\\t%2\", operands);