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

Re: [tcb] Value Range Propagation

Andrew> Thanks, Diego!  I really wanted this in order to get bounds check
Andrew> elimination working for Java.  I'll see if it does that.

Diego> I wouldn't be surprised if it needs a little tweaking.  I will be
Diego> evaluating this and elimination of redundant mudflap instrumentation
Diego> in the next few days.

I gave it a try today and it does not eliminate java bounds.  I think
the problem is due to the way we use a cast to unsigned to implement
the actual bounds check.

Take a look at the appended example.  It is analogous to the situation
with java arrays.  If you compile it as is, the dead __cxa_throw call
will not be removed.  If you define WORK_WORK_WORK, the dead call will
be removed.


// Define this to see it work.
// #define WORK_WORK_WORK

#define ORIG unsigned int
#define CAST
#define ORIG int
#define CAST (unsigned)

struct array
  const ORIG len;
  int *data;

extern void call (ORIG);

void doit (array *a)
  for (ORIG i = 0; i < a->len; ++i)
      if (CAST (i) >= CAST (a->len))
	throw 5;
      call (a->data[i]);

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