view gcc/testsuite/c-c++-common/Wimplicit-fallthrough-36.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* PR c/79153 */
/* { dg-do compile } */
/* { dg-options "-Wimplicit-fallthrough" } */

int
test (int v1, int v2)
{
  switch (v1)
    {
    case 3:
      switch (v2)	/* { dg-warning "this statement may fall through" } */
	{
	case 1:
	  return 28;
	case 2:
	  return 38;
	case 3:
	  return 88;
	default:
	  break;
	}
    case 4:		/* { dg-message "here" } */
      return 168;
    case 5:
      switch (v2)	/* { dg-warning "this statement may fall through" } */
	{
	case 4:
	  break;
	case 5:
	  return 38;
	case 6:
	  return 88;
	}
    case 6:		/* { dg-message "here" } */
      return 169;
    case 7:
      switch (v2)	/* { dg-warning "this statement may fall through" } */
	{
	case 7:
	  return 38;
	case 8:
	  return 88;
	}
    case 8:		/* { dg-message "here" } */
      return 170;
    case 9:
      switch (v2)	/* { dg-bogus "this statement may fall through" } */
	{
	case 9:
	  return 38;
	case 10:
	  return 88;
	default:
	  return 89;
	}
    case 10:
      return 171;
    case 11:
      switch (v2)	/* { dg-bogus "this statement may fall through" } */
	{
	case -__INT_MAX__ - 1 ... 31:
	  return 38;
	case 32:
	  return 88;
	case 33 ... __INT_MAX__:
	  return 89;
	}
    case 12:
      return 172;
    }
  return -1;
}