2011-03-01 03:49:42 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,core.experimental.IdempotentOps -analyzer-max-loop 3 -verify %s
|
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,core.experimental.IdempotentOps -analyzer-max-loop 4 -verify %s
|
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,core.experimental.IdempotentOps %s -verify
|
2010-10-19 07:36:05 +08:00
|
|
|
|
2011-02-15 01:59:23 +08:00
|
|
|
void always_warning() { int *p = 0; *p = 0xDEADBEEF; } // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
|
2010-10-19 07:36:05 +08:00
|
|
|
|
2011-02-15 01:59:23 +08:00
|
|
|
// This test case previously caused a bogus idempotent operation warning
|
|
|
|
// due to us not properly culling warnings due to incomplete analysis of loops.
|
2010-10-19 07:36:05 +08:00
|
|
|
int pr8403()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i=0; i<10; i++)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
for(j=0; j+1<i; j++)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|