problem building gerris on armel: Illegal instruction

Martin Guy martinwguy at gmail.com
Sun Apr 19 15:08:54 UTC 2009


On 4/19/09, Drew Parsons <dparsons at debian.org> wrote:
>  is in FPU_SETCW, so it's certainly related to Debian patch
>  fpucontrol-bug350595.patch.

Maybe

>  The illegal instruction is generated by
>  274        _FPU_SETCW (fpu_trap_exceptions);

/usr/include/fpu_control.h:

/* This is fmxr fpscr, %0.  */
#define _FPU_SETCW(cw) \
  __asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw))

This is a coprocessor instruction issued to an ARM coprocessor which
doesn't exist, since armel is soft-float by default and the xscale
doesn't have an FP coprocessor. This instruction is for coprocessor
10, which is the VFP floating point unit. But armel defaults to

So "Illegal instruction" is indeed correct. I'd say the bug is in the
header file, which is VFP specific.

I just tried the softfloat implementation and it returns +infinity for
1.0/x where x == 0.0 without raising an exception, so I would suggest
that, if disabling division by zero exception is your only use for the
FPU control setting, you can work around it using something like

#if defined(__ARM_EABI__) && defined(__SOFTFP__)
    /* ARM EABI soft float silently returns infinities on division by zero */
# else
   ... FPU_SETCW stuff ...
#endif

     M



More information about the debian-science-maintainers mailing list