Ted Kremenek | a8180e5 | 2012-01-20 06:00:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,experimental.deadcode.IdempotentOperations -analyzer-max-loop 3 -verify %s |
| 2 | // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,experimental.deadcode.IdempotentOperations -analyzer-max-loop 4 -verify %s |
| 3 | // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,experimental.deadcode.IdempotentOperations %s -verify |
Ted Kremenek | 6648e5d | 2010-10-18 23:36:05 +0000 | [diff] [blame] | 4 | |
Ted Kremenek | e8350c6 | 2011-02-14 17:59:23 +0000 | [diff] [blame] | 5 | void always_warning() { int *p = 0; *p = 0xDEADBEEF; } // expected-warning{{Dereference of null pointer (loaded from variable 'p')}} |
Ted Kremenek | 6648e5d | 2010-10-18 23:36:05 +0000 | [diff] [blame] | 6 | |
Ted Kremenek | e8350c6 | 2011-02-14 17:59:23 +0000 | [diff] [blame] | 7 | // This test case previously caused a bogus idempotent operation warning |
| 8 | // due to us not properly culling warnings due to incomplete analysis of loops. |
Ted Kremenek | 6648e5d | 2010-10-18 23:36:05 +0000 | [diff] [blame] | 9 | int pr8403() |
| 10 | { |
| 11 | int i; |
| 12 | for(i=0; i<10; i++) |
| 13 | { |
| 14 | int j; |
| 15 | for(j=0; j+1<i; j++) |
| 16 | { |
| 17 | } |
| 18 | } |
| 19 | return 0; |
| 20 | } |
| 21 | |