diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-11-13 16:28:05 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-11-13 16:29:09 +0000 |
commit | 03ac50856c9fc8c96b7a17239ee40a10397750a7 (patch) | |
tree | a648c6d3428e4757e003f6ed1748adb9613065db /gcc/testsuite/gcc.dg/strlenopt-19.c | |
parent | 34efdaf078b01a7387007c4e6bde6db86384c4b7 (diff) | |
download | gcc-tarball-03ac50856c9fc8c96b7a17239ee40a10397750a7.tar.gz |
gcc 7.2.0
This is imported manually due to a bug in the tarball import script.
See the baserock-dev mailing list archives (November 2017) for a
more detailed explaination of the issue.
Diffstat (limited to 'gcc/testsuite/gcc.dg/strlenopt-19.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/strlenopt-19.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/gcc/testsuite/gcc.dg/strlenopt-19.c b/gcc/testsuite/gcc.dg/strlenopt-19.c deleted file mode 100644 index 022ba8b478..0000000000 --- a/gcc/testsuite/gcc.dg/strlenopt-19.c +++ /dev/null @@ -1,80 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-strlen" } */ - -#include "strlenopt.h" - -__attribute__((noinline, noclone)) char * -fn1 (int x, int y, int z) -{ - static char buf[40]; - const char *p; - switch (x) - { - case 0: - p = "abcd"; - /* Prevent cswitch optimization. */ - asm volatile ("" : : : "memory"); - break; - case 1: - p = "efgh"; - break; - case 2: - p = "ijkl"; - break; - default: - p = "mnop"; - break; - } - if (y) - { - strcpy (buf, p); - if (z) - strcat (buf, "ABCDEFG"); - else - strcat (buf, "HIJKLMN"); - } - else - { - strcpy (buf, p + 1); - if (z) - strcat (buf, "OPQ"); - else - strcat (buf, "RST"); - } - return buf; -} - -int -main () -{ - int i; - for (i = 0; i < 5; i++) - { - const char *p = "abcdefghijklmnop" + (i < 3 ? i : 3) * 4; - const char *q; - fn1 (i ? 0 : 1, 1, 1); - q = fn1 (i, 0, 0); - if (memcmp (q, p + 1, 3) != 0 || memcmp (q + 3, "RST", 4) != 0) - abort (); - fn1 (i ? 0 : 1, 0, 1); - q = fn1 (i, 1, 0); - if (memcmp (q, p, 4) != 0 || memcmp (q + 4, "HIJKLMN", 8) != 0) - abort (); - fn1 (i ? 0 : 1, 1, 0); - q = fn1 (i, 0, 1); - if (memcmp (q, p + 1, 3) != 0 || memcmp (q + 3, "OPQ", 4) != 0) - abort (); - fn1 (i ? 0 : 1, 0, 0); - q = fn1 (i, 1, 1); - if (memcmp (q, p, 4) != 0 || memcmp (q + 4, "ABCDEFG", 8) != 0) - abort (); - } - return 0; -} - -/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "memcpy \\(" 6 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ -/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ |