Skip to content

Commit ae6e763

Browse files
committed
update c test
1 parent 5f72578 commit ae6e763

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

clang/test/Sema/shift-bool.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@
22

33
void t() {
44
int x = 10;
5-
int y = 1;
5+
int y = 5;
66

7-
int a = y << x;
8-
int b = y >> x;
7+
int a = (x < y) << 1;
8+
int b = (x < y) >> 1;
99

10-
int c = 0 << x;
11-
int d = 0 >> x;
10+
int c = (x > y) << 1;
11+
int d = (x > y) >> 1;
1212

13-
int e = y << 1;
14-
int f = y >> 1;
13+
int e = (x == y) << 1;
14+
int f = (x == y) >> 1;
1515

16-
int g = y << -1; // expected-warning {{shift count is negative}}
17-
int h = y >> -1; // expected-warning {{shift count is negative}}
16+
int g = (x != y) << 1;
17+
int h = (x != y) >> 1;
1818

19-
int i = y << 0;
20-
int j = y >> 0;
19+
int i = (x < y) << 0;
20+
int j = (x < y) >> 0;
2121

22-
if ((y << 1) != 0) { }
23-
if ((y >> 1) != 0) { }
22+
int k = (x < y) << -1; // expected-warning {{shift count is negative}}
23+
int l = (x < y) >> -1; // expected-warning {{shift count is negative}}
24+
25+
if (((x < y) << 1) != 0) { }
26+
if (((x < y) >> 1) != 0) { }
2427
}

0 commit comments

Comments
 (0)