This is the mail archive of the gcc@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]

Re: genattrtab.c [Am I on drugs?!?]


    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));


    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.

Why?  The sizes in alloca and in bcopy are the same and look right to me:
they are the size of the union, which will be the maximum of the sizes
of a pointer and HOST_WIDE_INT.

    What's scary is I have done significant work with a port over the last
    two years where sizeof (HOST_WIDE_INT) >= sizeof (pointer) 

Likewise (Alpha/VMS).

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