This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
genattrtab.c [Am I on drugs?!?]
- To: gcc at gcc dot gnu dot org
- Subject: genattrtab.c [Am I on drugs?!?]
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 30 Sep 1999 11:44:03 -0600
- Reply-To: law at cygnus dot com
OK. I must be on drugs, or we've had this bug lurking for so long it's
scary.
From genattrtab.c::simplify_cond:
int len = XVECLEN (exp, 0);
rtunion *tests = (rtunion *) alloca (len * sizeof (rtunion));
int allsame = 1;
char *first_spacer;
/* This lets us free all storage allocated below, if appropriate. */
first_spacer = (char *) obstack_finish (rtl_obstack);
bcopy ((char *) XVEC (exp, 0)->elem, (char *) tests, len * sizeof (rtunion));
XVEXP (exp, 0)->elem is a struct rtx_def *elem[1] ie a bunch of pointers to
rtxs.
tests is an array of rtunions
rtunion is:
typedef union rtunion_def
{
HOST_WIDE_INT rtwint;
int rtint;
char *rtstr;
struct rtx_def *rtx;
struct rtvec_def *rtvec;
enum machine_mode rttype;
addr_diff_vec_flags rt_addr_diff_vec_flags;
struct bitmap_head_def *rtbit;
union tree_node *rttree;
struct basic_block_def *bb;
} rtunion;
Note that if sizeof (HOST_WIDE_INT) >= sizeof (pointer), then we lose so
badly it's not funny in the bcopy shown above.
What's scary is I have done significant work with a port over the last two
years where sizeof (HOST_WIDE_INT) >= sizeof (pointer) and this problem never
tripped (until last night).
jeff