blob: caac2678bf3c0ecb9b7f68ae2953765389152484 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* Verify that we correctly consolidate conditionals in paths. */
#include "analyzer-decls.h"
extern int foo ();
extern int bar ();
extern int baz ();
void test_1 (int a, int b, int c)
{
if (a && b && c) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
__analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
}
void test_2 (int a, int b, int c)
{
if (a && b) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
if (c) /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
__analyzer_dump_path ();
}
void test_3 (int a, int b, int c)
{
if (a) /* { dg-message "\\(1\\) following 'true' branch" } */
if (b && c) /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
__analyzer_dump_path ();
}
void test_4 (void)
{
while (foo () && bar ()) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
__analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
}
void test_5 (int a, int b, int c)
{
if (a || b || c) /* { dg-message "\\(1\\) following 'false' branch\\.\\.\\." } */
{
}
else
__analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
}
void test_6 (void)
{
int i;
for (i = 0; i < 10 && foo (); i++) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
__analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
}
int test_7 (void)
{
if (foo () ? bar () ? baz () : 0 : 0) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
__analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
}
|