OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ieee/] [pr30704.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 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
__attribute__((noinline))
10
f1 (void)
11
{
12
  long long t;
13
  double d = 0x0.fffffffffffff000p-1022;
14
  memcpy (&t, &d, sizeof (long long));
15
  return t;
16
}
17
 
18
double
19
__attribute__((noinline))
20
f2 (void)
21
{
22
  long long t = 0x000fedcba9876543LL;
23
  double d;
24
  memcpy (&d, &t, sizeof (long long));
25
  return d;
26
}
27
 
28
int
29
main ()
30
{
31
  union
32
  {
33
    long long ll;
34
    double d;
35
  } u;
36
 
37
  if (sizeof (long long) != sizeof (double) || __DBL_MIN_EXP__ != -1021)
38
    return 0;
39
 
40
  u.ll = f1 ();
41
  if (u.d != 0x0.fffffffffffff000p-1022)
42
    abort ();
43
 
44
  u.d = f2 ();
45
  if (u.ll != 0x000fedcba9876543LL)
46
    abort ();
47
 
48
  double b = 234.0;
49
  long long c;
50
  double d = b;
51
  memcpy (&c, &b, sizeof (double));
52
  long long e = c;
53
  if (memcmp (&e, &d, sizeof (double)) != 0)
54
    abort ();
55
 
56
  return 0;
57
}

powered by: WebSVN 2.1.0

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