• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
2 // XFAIL: *
3 
test1_f1()4 int test1_f1() {
5   int y = 1;
6   y++;
7   return y;
8 }
9 
test1_f2()10 void test1_f2() {
11   int x = 1;
12   x = test1_f1();
13   if (x == 1) {
14     int *p = 0;
15     *p = 3; // no-warning
16   }
17   if (x == 2) {
18     int *p = 0;
19     *p = 3; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
20   }
21 }
22 
23 // Test that inlining works when the declared function has less arguments
24 // than the actual number in the declaration.
test2_f1()25 void test2_f1() {}
26 int test2_f2();
27 
test2_f3()28 void test2_f3() {
29   test2_f1(test2_f2()); // expected-warning{{too many arguments in call to 'test2_f1'}}
30 }
31 
32