aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/test-variably-modified-types.c
blob: 1df57affad4155a34b459af37954b15f1069d9c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyze-function=testVariablyModifiedTypes -verify %s

// Test that we process variably modified type correctly - the call graph construction should pick up function_with_bug while recursively visiting test_variably_modifiable_types.
unsigned getArraySize(int *x) {
  if (!x)
    return *x; // expected-warning {{Dereference of null pointer}}
  return 1;
}

int testVariablyModifiedTypes(int *x) {
  int mytype[getArraySize(x)];
  return 0;
}