summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wunreachable-2.c
blob: 8242441b0be6f193ef84dccf3f3d41cecbc4b724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* { dg-do compile } */
/* { dg-options "-O2 -Wunreachable-code" } */

extern int foo (const char *);
extern void baz (void);
const char *a[] = { "one", "two" };

void bar (void)
{
  int i;

  for (i = 0; i < 2; i++)
    if (! foo (a[i]))
      return;

  baz ();	/* { dg-bogus "will never be executed" } */
  baz ();
  baz ();
}