view gcc/testsuite/gcc.dg/Wswitch-unreachable-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

/* PR c/49859 */
/* { dg-do compile } */
/* { dg-options "-Wswitch-unreachable" } */

extern void foo (int);
extern int j;

void
fn0 (int i)
{
  switch (i)
    {
    int t = 10; /* { dg-warning "statement will never be executed" } */
    default:
      foo (t);
    }

  switch (i)
    { /* { dg-warning "statement will never be executed" } */
      int A[i];
      default: /* { dg-error "switch jumps into scope" } */
	break;
    }

  switch (i)
    default:
      j = sizeof (struct { int i; });

  switch (i)
    {
      int A[3];
      default:
	break;
    }
}