brintos

brintos / llvm-project-archived public Read only

0
0
Text · 730 B · ae3705f Raw
30 lines · c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s2 3void clang_analyzer_eval(int);4 5void callee(void **p) {6  int x;7  *p = &x;8  // expected-warning@-1 {{Address of stack memory associated with local \9variable 'x' is still referred to by the caller variable 'arr' upon \10returning to the caller}}11}12 13void loop(void) {14  void *arr[2];15  for (int i = 0; i < 2; ++i)16    callee(&arr[i]);17  // FIXME: Should be UNKNOWN.18  clang_analyzer_eval(arr[0] == arr[1]); // expected-warning{{FALSE}}19}20 21void loopWithCall(void) {22  void *arr[2];23  for (int i = 0; i < 2; ++i) {24    int x;25    arr[i] = &x;26  }27  // FIXME: Should be UNKNOWN.28  clang_analyzer_eval(arr[0] == arr[1]); // expected-warning{{TRUE}}29}30