[Mono-dev] Possible bug in exceptions-ia64.c (was Re: Possible bug in mini-ia64.c)

Bill Seurer seurer at us.ibm.com
Wed Sep 20 11:14:11 EDT 2006

mono-devel-list-bounces at lists.ximian.com wrote on 09/19/2006 11:13:52 AM:

> Could you take a look at "mono_arch_call_opcode" function in mini-ia64.c.

That reminded me, I noticed several probable problems in the ia64 exception
code when I was looking at it a while back.  It was in 1.1.15 and I haven't
checked the newer code.

For example, in exceptions-ia64.c:

static gpointer
get_real_call_filter (void)
      static gpointer filter;
      guint8 *start;
      gboolean inited = FALSE;
      ... some more decls ...
      if (inited)
            return filter;
      ... create some code at "start" ...
      filter = ia64_create_ftnptr (start);

      inited = TRUE;

      return filter;

"inited" isn't static above so the "if (inited)" check will always fail and
the code will always be recreated.  Maybe it should always be recreated but
then the "inited" stuff should be removed.

Also in exceptions-ia64.c:

mono_arch_get_throw_corlib_exception (void)
      static guint8* start;
      static gboolean inited = FALSE;
      ... some more decls ...
      if (inited)
            return start;
      ... create some code at "start" ...
      return ia64_create_ftnptr (start);

This code has inited as static but then never sets "inited" to anything
later on and thus fails as the previous one did (it always recreates the
code) albeit for a different reason.  Actually, this is fortunate because
if it did set inited to TRUE the wrong value would be returned, i.e., the
"raw" start not turned into a function descriptor (compare with
filter/start in the previous one).

I suspect there may be more of these.
Bill Seurer     IBM System i5 internal compiler development   Rochester, MN
Business: seurer at us.ibm.com                         Home: Bill at seurer.net
http://w3.rchland.ibm.com/~seurer/                  http://www.seurer.net

More information about the Mono-devel-list mailing list