NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-powerpc/50037: FPU handling on powerpc is broken



>Number:         50037
>Category:       port-powerpc
>Synopsis:       FPU handling on powerpc is broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 05 19:10:00 +0000 2015
>Originator:     Michael
>Release:        -current
>Organization:
NetBSD Foundation
>Environment:
NetBSD cointreau 7.99.19 NetBSD 7.99.19 (COINTREAU) #5: Sun Jul  5 14:37:25 EDT 2015  ml@blackbush:/stuff/build/obj/sys/arch/macppc/compile/COINTREAU macppc

>Description:
FPU registers get occasionally corrupted, apparently since FPU handling was switched to PCU:
http://mail-index.netbsd.org/source-changes/2011/05/02/msg021630.html
>How-To-Repeat:
#include <sys/types.h>
#include <stdio.h>
#include <math.h>


int main()
{
  register double a, b, c, d, e;
  double diff;
  uint8_t *boo = (void *)&diff;
  int i, j;

  a = 2.0;
  b = 3.0;
  d = 6.0;

  do {
    c = a * b;
    e = d - c;
    diff = fabs(e);
    if (diff > 0.001) {
      printf("diff: %f - %f %f %f %f %f\n", diff, a, b, c, d, e);
      for (j = 0; j < 8; j++) {
        printf(" %02x", boo[j]);
      }
      printf("\n");
    }
  } while (1);
  return 0;
}

Compile without optimization, get lots of this:
diff: 2147483648.000000 - 2.000000 3.000000 6.000000 6.000000 0.000000
 41 e0 00 00 00 00 00 00


>Fix:
n/a



Home | Main Index | Thread Index | Old Index