summaryrefslogtreecommitdiff
path: root/support/regression/tests/oldfmul.c
blob: d85644d6953aac88ec58012f4e14032f9a1dbb20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
   oldfmul.c - a bug that resulted in wrong results in an old float multiplication routine.
*/

#include <testfwk.h>

union float_long
  {
    float f;
    unsigned long l;
  };

#define HIDDEN		(unsigned long)(1ul << 23)

void lmul (unsigned long l, unsigned long r)
{
  ASSERT (l == HIDDEN >> 8);
  ASSERT (r == HIDDEN >> 8);

}

void oldfmul11 (void) {
  volatile union float_long fl1, fl2;

  fl1.l = HIDDEN;
  fl2.l = HIDDEN;

  lmul((fl1.l >> 8), (fl2.l >> 8));
}

void
testBug (void)
{
  oldfmul11 ();
}