2 /* { dg-do compile { target { bitint } } } */
3 /* { dg-options "-std=c23 -fpermissive -Wint-in-bool-context -Waddress -Wpointer-to-int-cast -Wint-to-pointer-cast -Wint-conversion -Wshift-negative-value -Wshift-count-overflow -Wdiv-by-zero" } */
10 foo (_BitInt(61) x
, long long *y
)
12 if (x
<< 15) /* { dg-warning "'<<' in boolean context, did you mean '<'" } */
14 bar ((_BitInt(sizeof (void *) * __CHAR_BIT__
)) (ax
+ 0) == 0);
15 bar ((unsigned _BitInt(sizeof (void *) * __CHAR_BIT__
)) (ax
+ 1) == 0);
16 char *z
= __builtin_assume_aligned (y
, 32wb
, 8wb
);
18 _BitInt(sizeof (void *) * __CHAR_BIT__
+ 1) a
= (_BitInt(sizeof (void *) * __CHAR_BIT__
+ 1)) y
; /* { dg-warning "cast from pointer to integer of different size" } */
19 unsigned _BitInt(sizeof (void *) * __CHAR_BIT__
+ 1) b
= (unsigned _BitInt(sizeof (void *) * __CHAR_BIT__
+ 1)) y
; /* { dg-warning "cast from pointer to integer of different size" } */
20 _BitInt(sizeof (void *) * __CHAR_BIT__
- 1) c
= (_BitInt(sizeof (void *) * __CHAR_BIT__
- 1)) y
; /* { dg-warning "cast from pointer to integer of different size" } */
21 unsigned _BitInt(sizeof (void *) * __CHAR_BIT__
- 1) d
= (unsigned _BitInt(sizeof (void *) * __CHAR_BIT__
- 1)) y
; /* { dg-warning "cast from pointer to integer of different size" } */
22 void *e
= (void *) a
; /* { dg-warning "cast to pointer from integer of different size" } */
23 void *f
= (void *) b
; /* { dg-warning "cast to pointer from integer of different size" } */
24 void *g
= (void *) c
; /* { dg-warning "cast to pointer from integer of different size" } */
25 void *h
= (void *) d
; /* { dg-warning "cast to pointer from integer of different size" } */
26 a
= y
; /* { dg-warning "assignment to '_BitInt\\\(\[0-9]+\\\)' from 'long long int \\\*' makes integer from pointer without a cast" } */
27 b
= y
; /* { dg-warning "assignment to 'unsigned _BitInt\\\(\[0-9]+\\\)' from 'long long int \\\*' makes integer from pointer without a cast" } */
28 c
= y
; /* { dg-warning "assignment to '_BitInt\\\(\[0-9]+\\\)' from 'long long int \\\*' makes integer from pointer without a cast" } */
29 d
= y
; /* { dg-warning "assignment to 'unsigned _BitInt\\\(\[0-9]+\\\)' from 'long long int \\\*' makes integer from pointer without a cast" } */
30 e
= a
; /* { dg-warning "assignment to 'void \\\*' from '_BitInt\\\(\[0-9]+\\\)' makes pointer from integer without a cast" } */
31 f
= b
; /* { dg-warning "assignment to 'void \\\*' from 'unsigned _BitInt\\\(\[0-9]+\\\)' makes pointer from integer without a cast" } */
32 g
= c
; /* { dg-warning "assignment to 'void \\\*' from '_BitInt\\\(\[0-9]+\\\)' makes pointer from integer without a cast" } */
33 h
= d
; /* { dg-warning "assignment to 'void \\\*' from 'unsigned _BitInt\\\(\[0-9]+\\\)' makes pointer from integer without a cast" } */
34 _BitInt(61) i
= (1wb
- 1152921504606846975wb
) << 1; /* { dg-warning "left shift of negative value" } */
35 /* { dg-warning "result of '-1152921504606846974 << 1' requires 62 bits to represent, but '_BitInt\\\(61\\\)' only has 61 bits" "" { target *-*-* } .-1 } */
36 _BitInt(61) j
= i
<< (60 + 1); /* { dg-warning "left shift count >= width of type" } */
37 _BitInt(61) k
= i
>> (60 + 1); /* { dg-warning "right shift count >= width of type" } */
38 _BitInt(61) l
= i
/ (51wb
- 51wb
); /* { dg-warning "division by zero" } */