1 // RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
2 // RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
4 int string_literal_init() {
6 char b
[2] = "abc"; // expected-warning{{too long}}
10 return 0; // expected-warning{{never executed}}
12 return 0; // expected-warning{{never executed}}
14 return 0; // expected-warning{{never executed}}
17 return 0; // expected-warning{{never executed}}
19 return 0; // expected-warning{{never executed}}
22 return 0; // expected-warning{{never executed}}
27 void nested_compound_literals(int rad
) {
28 int vec
[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
29 {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
32 for (a
= 0; a
< 6; ++a
) {
33 vec
[a
][0] *= rad
; // no-warning
34 vec
[a
][1] *= rad
; // no-warning
38 void nested_compound_literals_float(float rad
) {
39 float vec
[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
40 {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
43 for (a
= 0; a
< 6; ++a
) {
44 vec
[a
][0] *= rad
; // no-warning
45 vec
[a
][1] *= rad
; // no-warning