Paranoia flaw on pc386

Jiri Gaisler jiri at gaisler.se
Fri Jul 19 20:21:11 UTC 2013



On 07/19/2013 05:32 PM, Ardalan Pouyabahar wrote:
> Thanks Joel. I read them all, it helped a lot but I couldn't find a way to solve
> it yet.


Remember that the x87 has a 64-bit mantissa (extended-precision), compared
to 53-bits (double precision) in most other architectures. To pass paranoia,
make sure you set the x87 FPU to round-to-nearest AND double-precision.
The default extended-precision can lead to paranoia errors due to too high
precision in intermediate results.


Sample code to set up the FPU control register could be:

    volatile unsigned short cw = 0x1272;

    __asm__ volatile ("fldcw %0"::"m" (cw));


The above settings might trigger FPU exceptions running paranoia, since the
application generates various overflow/underflow/divide-zero conditions.
If you want to suppress all FPU exceptions, you can set cw = 0x127F;
This is however not recommended in flight code since you really would
like to catch any arithmetic error as early as possible ...

Jiri.

> 
> 
> On Thu, Jul 18, 2013 at 11:07 PM, Joel Sherrill <joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>> wrote:
> 
>     The compiler flags and optimizations matter a lot on x86.
>     There are lots of discussions when gcc is benchmarked
>     against icc like this one:
> 
>     http://gcc.gnu.org/ml/gcc/__2012-01/msg00238.html
>     <http://gcc.gnu.org/ml/gcc/2012-01/msg00238.html>
> 
>     But specifically, there is a discussion of gcc and paranoia
>     here which appears to match your report.
> 
>     http://gcc.gnu.org/ml/gcc/__2004-03/msg01468.html
>     <http://gcc.gnu.org/ml/gcc/2004-03/msg01468.html>
> 
>     --joel
> 
> 
>     On 7/18/2013 1:30 PM, Gedare Bloom wrote:
> 
>         I think the FLAWs can be safely ignored, but may be will matter if
>         your application uses floating point operations.
> 
>         On Thu, Jul 18, 2013 at 2:24 PM, Ardalan Pouyabahar
>         <a.pouyabahar at ece.ut.ac.ir <mailto:a.pouyabahar at ece.ut.ac.ir>> wrote:
> 
>             Hello,
>             Paranoia output on rtems pc386 had 1 flaw which was this:
> 
>             Sticky bit used incorrectly or not at all.
>             TEST: lack(s) of guard digits or failure(s) to correctly round or chop
>             (noted above) count as one flaw in the final tally below
>             ERROR: Severity: FLAW:  lack(s) of guard digits or failure(s) to
>             correctly
>             round or chop
>             (noted above) count as one flaw in the final tally below.
>             PASS: lack(s) of guard digits or failure(s) to correctly round or chop
>             (noted above) count as one flaw in the final tally below
> 
>             I've searched in rtems mailing list and google but couldn't find
>             anything
>             useful yet. Does anyone know what it means and how can I solve it?
>             I compiled whole rtems and paranoia without optimization.
>             Thanks,
>             A.Pouyabahar
> 
> 
>             _________________________________________________
>             rtems-users mailing list
>             rtems-users at rtems.org <mailto:rtems-users at rtems.org>
>             http://www.rtems.org/mailman/__listinfo/rtems-users
>             <http://www.rtems.org/mailman/listinfo/rtems-users>
> 
>         _________________________________________________
>         rtems-users mailing list
>         rtems-users at rtems.org <mailto:rtems-users at rtems.org>
>         http://www.rtems.org/mailman/__listinfo/rtems-users
>         <http://www.rtems.org/mailman/listinfo/rtems-users>
> 
> 
> 
>     -- 
>     Joel Sherrill, Ph.D.             Director of Research & Development
>     joel.sherrill at OARcorp.com        On-Line Applications Research
>     Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>     Support Available                (256) 722-9985
> 
> 
>     _________________________________________________
>     rtems-users mailing list
>     rtems-users at rtems.org <mailto:rtems-users at rtems.org>
>     http://www.rtems.org/mailman/__listinfo/rtems-users
>     <http://www.rtems.org/mailman/listinfo/rtems-users>
> 
> 
> 
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
> 



More information about the users mailing list