summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/fpreg1.C
blob: c5170a4a4b6404e60f1e8485c8a968be2658ad4b (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Test permitted and invalid uses of __fpreg, for C++.
// Origin: Joseph Myers <joseph@codesourcery.com>
// { dg-do compile { target ia64-*-* } }
// { dg-options "" }

__float80 f80;
double d;
// Default initialized __fpreg is OK.
__fpreg fpreg, fpreg2;
// But explicitly zero-initialized is an invalid conversion.
__fpreg fi = 0; // { dg-error "invalid conversion to '__fpreg'" }

__fpreg f0 (__fpreg);
int f1 (__float80);

// __fpreg in a structure is OK.
struct s {
  __float80 b;
  __fpreg a;
} x;

void
f (void)
{
  __fpreg *p;
  // Valid operations.
  fpreg = fpreg2;
  fpreg2 = (__fpreg) fpreg;
  fpreg = f0 (fpreg2);
  fpreg = +fpreg2;
  p = &fpreg;
  (void) fpreg;
  fpreg = x.a;
  fpreg2 = (struct s) { 0 }.a;
  fpreg = (d ? fpreg : fpreg2);
  d = sizeof (fpreg);
  (void)(fpreg, fpreg);
  // Invalid operations.
  ++fpreg; // { dg-error "invalid operation on '__fpreg'" }
  --fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg++; // { dg-error "invalid operation on '__fpreg'" }
  fpreg--; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = -fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = ~fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = !fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = *fpreg; // { dg-error "invalid type argument" }
  if (fpreg) // { dg-error "invalid conversion from '__fpreg'" }
    return;
  d = fpreg; // { dg-error "invalid conversion from '__fpreg'" }
  d = (double) fpreg; // { dg-error "invalid conversion from '__fpreg'" }
  fpreg = (__fpreg) d; // { dg-error "invalid conversion to '__fpreg'" }
  fpreg = fpreg * fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg / fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg % fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg + fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg - fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg << fpreg; // { dg-error "invalid operation on '__fpreg'" }
  fpreg = fpreg >> fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg < fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg > fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg <= fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg >= fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg == fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg != fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg & fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg ^ fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg | fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg && fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = fpreg || fpreg; // { dg-error "invalid operation on '__fpreg'" }
  d = (fpreg ? 1 : 2); // { dg-error "invalid conversion from '__fpreg'" }
  fpreg = (d ? fpreg : d); // { dg-error "invalid conversion to '__fpreg'" }
  fpreg *= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg /= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg %= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg += fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg -= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg <<= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg >>= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg &= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg ^= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
  fpreg |= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
}