aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr94362-2.c
blob: 301d2ed6063ba17be80f54d7693d48789be8635f (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
/* Verify that we consider various paths to be impossible,
   using functions to thwart early optimizations.  */

#include "analyzer-decls.h"

void test_1 (int idx)
{
  if (idx > 0)
    if (idx - 1 < 0)
      __analyzer_dump_path (); /* { dg-bogus "" } */
}

static int called_by_test_1a (int idx)
{
  return idx - 1;
}

void test_1a (int idx)
{
  if (idx > 0)
    if (called_by_test_1a (idx) < 0)
      __analyzer_dump_path (); /* { dg-bogus "" } */
}

void test_2 (int idx)
{
  if (idx + 1 > 0)
    if (idx < 0)
      __analyzer_dump_path (); /* { dg-bogus "" } */
}

static int called_by_test_2a (int idx)
{
  return idx + 1;
}

void test_2a (int idx)
{
  if (called_by_test_2a (idx) > 0)
    if (idx < 0)
      __analyzer_dump_path (); /* { dg-bogus "" } */
}