diff options
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtin-unreachable-5.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtin-unreachable-6.c | 21 |
3 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7b0a5c..fd23351 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-07-09 Tom de Vries <tom@codesourcery.com> + Richard Guenther <rguenther@suse.de> + + * gcc.dg/builtin-unreachable-6.c: New test. + * gcc.dg/builtin-unreachable-5.c: New test. + 2012-07-07 Steven Bosscher <steven@gcc.gnu.org> PR tree-optimization/53881 diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-5.c b/gcc/testsuite/gcc.dg/builtin-unreachable-5.c new file mode 100644 index 0000000..f6fb4ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-unreachable-5.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +int +foo (int a) +{ + if (a <= 0) + { + L1: + __builtin_unreachable (); + } + + if (a > 2) + goto L1; + + return a > 0; +} + +/* { dg-final { scan-tree-dump-times "if \\(" 0 "fab" } } */ +/* { dg-final { scan-tree-dump-times "goto" 0 "fab" } } */ +/* { dg-final { scan-tree-dump-times "L1:" 0 "fab" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_unreachable" 0 "fab" } } */ +/* { dg-final { cleanup-tree-dump "fab" } } */ diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-6.c b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c new file mode 100644 index 0000000..26b5ac7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-fab" } */ + +void +foo (int b, int c) +{ + void *x = &&lab; + if (b) + { +lab: + __builtin_unreachable (); + } +lab2: + if (c) + x = &&lab2; + goto *x; +} + +/* { dg-final { scan-tree-dump-times "lab:" 1 "fab" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_unreachable" 1 "fab" } } */ +/* { dg-final { cleanup-tree-dump "fab" } } */ |