This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for genrecog.c bug in predicate generation
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org, zack at codesourcery dot com
- Date: Thu, 9 Sep 2004 15:20:35 -0700 (PDT)
- Subject: Patch for genrecog.c bug in predicate generation
- Reply-to: sje at cup dot hp dot com
I had a very bizzare bug in that I could build a native HP-UX IA64
compiler but not a cross-compiler version. I finally tracked it down to
a bug in compute_predicate_codes in genrecog.c where we are accessing
uninitialized memory due to using 'codes' instead of 'op0_codes' when
handing NOT. This could affect any md file that has a NOT in a
predicate.
With this change I can build a cross-compiler and a working insn-recog.c
file again but I can't do a complete build and test due to other bugs.
Ok for checkin?
Steve Ellcey
sje@cup.hp.com
2004-09-09 Steve Ellcey <sje@cup.hp.com>
* genrecog.c (compute_predicate_codes): Use op0_codes
instead of codes.
*** gcc.orig/gcc/gcc/genrecog.c Thu Sep 9 15:09:40 2004
--- gcc/gcc/gcc/genrecog.c Thu Sep 9 15:09:50 2004
*************** compute_predicate_codes (rtx exp, char c
*** 254,260 ****
case NOT:
compute_predicate_codes (XEXP (exp, 0), op0_codes);
for (i = 0; i < NUM_RTX_CODE; i++)
! codes[i] = TRISTATE_NOT (codes[i]);
break;
case IF_THEN_ELSE:
--- 254,260 ----
case NOT:
compute_predicate_codes (XEXP (exp, 0), op0_codes);
for (i = 0; i < NUM_RTX_CODE; i++)
! codes[i] = TRISTATE_NOT (op0_codes[i]);
break;
case IF_THEN_ELSE: