xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/overflow.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -Eonly %s -verify -triple i686-pc-linux-gnu
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // Multiply signed overflow
4*f4a2713aSLionel Sambuc #if 0x7FFFFFFFFFFFFFFF*2 // expected-warning {{overflow}}
5*f4a2713aSLionel Sambuc #endif
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // Multiply unsigned overflow
8*f4a2713aSLionel Sambuc #if 0xFFFFFFFFFFFFFFFF*2
9*f4a2713aSLionel Sambuc #endif
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc // Add signed overflow
12*f4a2713aSLionel Sambuc #if 0x7FFFFFFFFFFFFFFF+1 // expected-warning {{overflow}}
13*f4a2713aSLionel Sambuc #endif
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc // Add unsigned overflow
16*f4a2713aSLionel Sambuc #if 0xFFFFFFFFFFFFFFFF+1
17*f4a2713aSLionel Sambuc #endif
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // Subtract signed overflow
20*f4a2713aSLionel Sambuc #if 0x7FFFFFFFFFFFFFFF- -1 // expected-warning {{overflow}}
21*f4a2713aSLionel Sambuc #endif
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // Subtract unsigned overflow
24*f4a2713aSLionel Sambuc #if 0xFFFFFFFFFFFFFFFF- -1 // expected-warning {{converted from negative value}}
25*f4a2713aSLionel Sambuc #endif
26