1 |
149 |
jeremybenn |
/* { dg-do compile } */
|
2 |
|
|
/* { dg-options "-std=gnu99" } */
|
3 |
|
|
|
4 |
|
|
/* C99 6.5.10: Bitwise AND operator.
|
5 |
|
|
C99 6.5.11: Bitwise exclusive OR operator.
|
6 |
|
|
C99 6.5.12: Bitwise inclusive OR operator.
|
7 |
|
|
|
8 |
|
|
Test that these operators do not accept decimal float operands. */
|
9 |
|
|
|
10 |
|
|
extern void abort (void);
|
11 |
|
|
|
12 |
|
|
#define OPERATE(OPRD1,OPRT,OPRD2) \
|
13 |
|
|
do \
|
14 |
|
|
{ \
|
15 |
|
|
OPRD1 OPRT OPRD2; \
|
16 |
|
|
} while (0)
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
#define DECIMAL_BITWISE_OPERATOR(OPRT,OPRD) \
|
21 |
|
|
do \
|
22 |
|
|
{ \
|
23 |
|
|
OPERATE(OPRD,OPRT,1); \
|
24 |
|
|
OPERATE(OPRD,OPRT,0); \
|
25 |
|
|
OPERATE(OPRD,OPRT,0x15); \
|
26 |
|
|
OPERATE(0,OPRT,OPRD); \
|
27 |
|
|
OPERATE(1,OPRT,OPRD); \
|
28 |
|
|
OPERATE(0x15,OPRT,OPRD); \
|
29 |
|
|
} while (0)
|
30 |
|
|
|
31 |
|
|
void operator_notfor_decimal()
|
32 |
|
|
{
|
33 |
|
|
_Decimal32 d32;
|
34 |
|
|
_Decimal64 d64;
|
35 |
|
|
_Decimal128 d128;
|
36 |
|
|
|
37 |
|
|
/* C99 Section 6.5.7 Bitwise shift operators. Operands must have
|
38 |
|
|
integer type (which the decimal float types are not). */
|
39 |
|
|
|
40 |
|
|
d32 << 1; /* { dg-error "invalid operands to binary" } */
|
41 |
|
|
d32 >> 1; /* { dg-error "invalid operands to binary" } */
|
42 |
|
|
d64 << 1; /* { dg-error "invalid operands to binary" } */
|
43 |
|
|
d64 >> 1; /* { dg-error "invalid operands to binary" } */
|
44 |
|
|
d128 << 1; /* { dg-error "invalid operands to binary" } */
|
45 |
|
|
d128 >> 1; /* { dg-error "invalid operands to binary" } */
|
46 |
|
|
|
47 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
|
48 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
|
49 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
|
50 |
|
|
|
51 |
|
|
/* C99 Section 6.5.{10,11,12} Bitwise operator. Constraints: Each of
|
52 |
|
|
the operands shall have integer type. DFP type is reject by compiler
|
53 |
|
|
when bitwise operation is performed. */
|
54 |
|
|
|
55 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
|
56 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
|
57 |
|
|
DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
|
58 |
|
|
|
59 |
|
|
DECIMAL_BITWISE_OPERATOR(|,d32); /* { dg-error "invalid operands to binary" } */
|
60 |
|
|
DECIMAL_BITWISE_OPERATOR(|,d64); /* { dg-error "invalid operands to binary" } */
|
61 |
|
|
DECIMAL_BITWISE_OPERATOR(|,d128); /* { dg-error "invalid operands to binary" } */
|
62 |
|
|
|
63 |
|
|
DECIMAL_BITWISE_OPERATOR(^,d32); /* { dg-error "invalid operands to binary" } */
|
64 |
|
|
DECIMAL_BITWISE_OPERATOR(^,d64); /* { dg-error "invalid operands to binary" } */
|
65 |
|
|
DECIMAL_BITWISE_OPERATOR(^,d128); /* { dg-error "invalid operands to binary" } */
|
66 |
|
|
}
|