diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wduplicated-branches-11.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/Wduplicated-branches-11.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wduplicated-branches-11.c b/gcc/testsuite/c-c++-common/Wduplicated-branches-11.c new file mode 100644 index 0000000..70d86cf --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wduplicated-branches-11.c @@ -0,0 +1,75 @@ +/* PR c/64279 */ +/* { dg-do compile } */ +/* { dg-options "-Wduplicated-branches" } */ + +int +f (int p) +{ + if (p == 0) + { + p += 1, ++p; + } + else + { + p -= 1, ++p; + } + + if (p == 1) + { + } + else + p++; + + if (p == 2) + p++; + else + { + } + + if (p == 3) + { + } + else + { + } + + if (p == 4) + { + ++p; + return p; + } + else + { + p++; + return p; + } + + if (p == 5) + ++p; + else + p++; + + if (p == 6) + { + ++p; + ++p; + return p; + } + else + { + ++p; + return p; + } + + if (p == 7) + { + ++p; + return p; + } + else + { + ++p; + ++p; + return p; + } +} |