summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr42363.c
blob: 9c9da1373dd49498705fcef8f87739fce228fc77 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* PR middle-end/pr42363, extended from the test for PR middle-end/37913.  */
/* { dg-do compile } */
/* { dg-options "-g" } */

void foo (void) __attribute__ ((noreturn));

static int __attribute__ ((noreturn))
bar (void)
{
  foo ();
}

int
baz (void)
{
  int i = bar ();
  return i + 1;
}

int fooz (void) __attribute__ ((noreturn));

static int __attribute__ ((noreturn))
bart (void)
{
  return fooz (); /* { dg-warning "noreturn" } */
}

int bazr (void)
{
  int i = bart ();
  return i + 1;
}

static inline int
bard (void)
{
  return fooz ();
}

int bizr (void)
{
  int i, j;

  i = j = bard ();

  return i + 1;
}

/* This might be regarded as pure and folded, rather than inlined.
   It's pure evil.  */
static int __attribute__ ((pure, const, noreturn))
barf (void)
{
} /* { dg-warning "does return" } */

static int __attribute__ ((pure, const))
bark (void)
{
  barf ();
}

int buzr (void)
{
  int i, j;

  i = j = bark () + bark ();

  return i + 1;
}

int buzt (void)
{
  int i, j;

  i = j = barf () + barf ();

  return i + 1;
}

void bust (void)
{
  while (barf ())
    ;
}