
On Fri, 2008-09-12 at 13:52 +0200, Henning Rogge wrote:
> Am Freitag 12 September 2008 13:21:02 schrieb Bernd Petrovitsch:
> > Hi!
> >
> > I get deterministically a SIGFPE with the tip of
> > http://gredler.at/hg/olsrd.
> >
> > gdb rells me:
> > ----  snip  ----
> > -- ALL PLUGINS LOADED! --
> >
> > Warning: probably sizeof(pointer) in strscpy(0x8eb0750, gaz, 4)!
> > Warning: probably sizeof(pointer) in strscpy(0x8ef08d0, geb, 4)!
> > Warning: probably sizeof(pointer) in strscpy(0x8ef5140, geb, 4)!
> >
> > Program received signal SIGFPE, Arithmetic exception.
> > [Switching to Thread -1208047936 (LWP 18692)]
> > 0x0805e90b in olsr_start_timer (rel_time=0, jitter_pct=5 '\005',
> > periodical=OLSR_FALSE, timer_cb_function=0x7fffffff, context=0x8eacd88,
> > cookie=14) at src/scheduler.c:223 223     /**
> There are floating point operations in the scheduler ???

Now that you mention it: It seems so and that's also strange. I don't
think it has to do with the VIA-C3/Samuel the thing runs on.

BTW the source in question:
----  snip  ----
static clock_t
olsr_jitter(unsigned int rel_time, olsr_u8_t jitter_pct, unsigned int random_val)
{
  unsigned int jitter_time;

  /*
   * No jitter or, jitter larger than 99% does not make sense.
   * Also protect against overflows resulting from > 25 bit timers.
   */
  if (jitter_pct == 0 || jitter_pct > 99 || rel_time > (1 << 24)) {
    return GET_TIMESTAMP(rel_time);
  }

  /*
   * Play some tricks to avoid overflows with integer arithmetic.
   */
  jitter_time = (jitter_pct * rel_time) / 100;
  jitter_time = random_val / (1 + RAND_MAX / jitter_time);

#if 0
  OLSR_PRINTF(3, "TIMER: jitter %u%% rel_time %ums to %ums\n",
	      jitter_pct, rel_time, rel_time - jitter_time);
#endif

  return GET_TIMESTAMP(rel_time - jitter_time);
}
----  snip  ----
Line 223 is the last GET_TIMESTAMP
So only int's and unsigned int's aFAICS.
Hm, I will try with another compiler and/or CFLAGS etc. - or go read the
assembler code when I find time.

	Bernd

[0]: I don't think that someone does "kill(SIGFPE, getpid());"
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




