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: Exception Handling address comparison implementation error


	I tried changing fde_unencoded_compare to

static saddr
fde_unencoded_compare (struct object *ob __attribute__((unused)),
                       fde *x, fde *y)
{
  if (x->pc_begin < y->pc_begin)
    return -1;
  else if (x->pc_begin > y->pc_begin)
    return 1;
  else
    return 0;
}

but that does not work correctly for me.  Maybe I am missing some trivial
typo.

	I still am trying to figure out if the signed integer sort was
intended for the "linear" and "erratic" address arrays.  A comment says:

   Split LINEAR into a linear sequence with low values and an erratic
   sequence with high values, put the linear one (of longest possible
   length) into LINEAR and the erratic one into ERRATIC.

The signed integer comparison first is used to determine when to place
FDEs on the erratic list.

	The signed integer final sort does not seem like it could work
with a binary search of the resulting table comparing unsigned addresses
(pc and pc_begin are "void *"):


      size_t i = (lo + hi) / 2;
      fde *f = vec->array[i];

      pc_begin = ((void **)f->pc_begin)[0];
      pc_range = ((uaddr *)f->pc_begin)[1];

      if (pc < pc_begin)
        hi = i;
      else if (pc >= pc_begin + pc_range)
        lo = i + 1;
      else
        return f;


Thanks, David


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