OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ieee/] [pr30704.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* PR middle-end/30704 */
2
 
3
typedef __SIZE_TYPE__ size_t;
4
extern void abort (void);
5
extern int memcmp (const void *, const void *, size_t);
6
extern void *memcpy (void *, const void *, size_t);
7
 
8
long long
9
f1 (void)
10
{
11
  long long t;
12
  double d = 0x0.fffffffffffff000p-1022;
13
  memcpy (&t, &d, sizeof (long long));
14
  return t;
15
}
16
 
17
double
18
f2 (void)
19
{
20
  long long t = 0x000fedcba9876543LL;
21
  double d;
22
  memcpy (&d, &t, sizeof (long long));
23
  return d;
24
}
25
 
26
int
27
main ()
28
{
29
  union
30
  {
31
    long long ll;
32
    double d;
33
  } u;
34
 
35
  if (sizeof (long long) != sizeof (double) || __DBL_MIN_EXP__ != -1021)
36
    return 0;
37
 
38
  u.ll = f1 ();
39
  if (u.d != 0x0.fffffffffffff000p-1022)
40
    abort ();
41
 
42
  u.d = f2 ();
43
  if (u.ll != 0x000fedcba9876543LL)
44
    abort ();
45
 
46
  double b = 234.0;
47
  long long c;
48
  double d = b;
49
  memcpy (&c, &b, sizeof (double));
50
  long long e = c;
51
  if (memcmp (&e, &d, sizeof (double)) != 0)
52
    abort ();
53
 
54
  return 0;
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.