Skip to content

Commit 6d3dd39

Browse files
committed
revert test
1 parent a2be531 commit 6d3dd39

File tree

1 file changed

+6
-58
lines changed

1 file changed

+6
-58
lines changed

clang/test/Analysis/div-zero.cpp

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,13 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++20 -verify %s
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -verify %s
22

3-
namespace GH10616 {
4-
int foo(int qX) {
3+
int fooPR10616 (int qX ) {
54
int a, c, d;
65

7-
d = (qX - 1);
8-
while (d != 0) {
9-
d = c - (c / d) * d;
6+
d = (qX-1);
7+
while ( d != 0 ) {
8+
d = c - (c/d) * d;
109
}
1110

12-
return (a % (qX - 1)); // expected-warning {{Division by zero}}
13-
}
14-
} // namespace GH10616
15-
16-
namespace GH148875 {
17-
struct A {
18-
int x;
19-
A(int v) : x(v) {}
20-
};
21-
22-
struct B {
23-
int x;
24-
B() : x(0) {}
25-
};
26-
27-
struct C {
28-
int x, y;
29-
C(int a, int b) : x(a), y(b) {}
30-
};
31-
32-
struct D {
33-
int x;
34-
};
35-
36-
struct E {
37-
D d;
38-
E(int a) : d(a) {}
39-
};
40-
41-
int t1() {
42-
A a(42);
43-
return 1 / (a.x - 42); // expected-warning {{Division by zero}}
44-
}
45-
46-
int t2() {
47-
B b;
48-
return 1 / b.x; // expected-warning {{Division by zero}}
49-
}
50-
51-
int t3() {
52-
C c1(1, -1);
53-
return 1 / (c1.x + c1.y); // expected-warning {{Division by zero}}
54-
}
55-
56-
int t4() {
57-
C c2(0, 0);
58-
return 1 / (c2.x + c2.y); // expected-warning {{Division by zero}}
59-
}
11+
return (a % (qX-1)); // expected-warning {{Division by zero}}
6012

61-
int t5() {
62-
E e = 32;
63-
return 1 / (e.d.x - 32); // expected-warning {{Division by zero}}
6413
}
65-
} // namespace GH148875

0 commit comments

Comments
 (0)