From: Richard Biener Date: Wed, 14 Dec 2016 10:35:11 +0000 (+0000) Subject: re PR tree-optimization/78731 (Possible bug with switch when optimization is turned... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=007e18eb1f26a71ffd2eb598f3021a0c4be2aeb0;p=gcc.git re PR tree-optimization/78731 (Possible bug with switch when optimization is turned on.) 2016-12-14 Richard Biener PR tree-optimization/78731 * gcc.dg/torture/pr78731.c: New testcase. From-SVN: r243644 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 43cf4900f5a..1d1b0346056 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-14 Richard Biener + + PR tree-optimization/78731 + * gcc.dg/torture/pr78731.c: New testcase. + 2016-12-14 Martin Liska * gcc.dg/tree-ssa/20040703-1.c: Update scanned pattern. diff --git a/gcc/testsuite/gcc.dg/torture/pr78731.c b/gcc/testsuite/gcc.dg/torture/pr78731.c new file mode 100644 index 00000000000..5a4d43be1f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78731.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ + +#include +#include + +#define GENERAL 1 +#define BRACKETS 2 +#define QUOTES 3 + +void __attribute__((noinline,noclone)) +foo(char *qb, char* into) +{ + int state = QUOTES; + int save_state = BRACKETS; + + while (qb) + { + switch (state) + { + case BRACKETS: + exit(0); + case GENERAL: + abort (); + case QUOTES: + state = save_state; + save_state = GENERAL; + break; + default: ; + } + printf("State %d btw GENERAL %d\n", state, GENERAL); + } + abort (); +} + +int main() +{ + char *b = "123"; + char out[4]; + foo(b, out); + return 0; +}