view gcc/testsuite/gcc.dg/Wswitch-unreachable-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
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;
    }
}