diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/20070507-1.c | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/20070507-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/20070507-1.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20070507-1.c b/gcc/testsuite/gcc.dg/20070507-1.c new file mode 100644 index 000000000..2884d1aa8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20070507-1.c @@ -0,0 +1,103 @@ +/* This failed on s390x due to bug in loop.c. + loop.c failed to remove a REG_EQUAL note when + hoisting an insn from a loop body. */ + +/* { dg-options "-O3 -fPIC" } */ +/* { dg-do run { target fpic } } */ + +typedef __SIZE_TYPE__ size_t; +int memcmp(const void *s1, const void *s2, size_t n); + +typedef struct +{ + char name[30]; + int a; +} LOCAL; + +int global = 0; +int sy = 1; +int subroutine_offset; + +LOCAL local = { "local", 0 }; +LOCAL keywords = { "keywords", 1 }; +int local_table = 0; +int keywords_table = 0; + +void __attribute__((noinline)) bar (char *p_buffer) +{ + p_buffer[255] = 1; +} + +int __attribute__((noinline)) foo (char *p_str1) +{ + global = 1; + return 1; +} + +int __attribute__((noinline)) loop_next (int *p_table, char *p_table_head) +{ + static loop_next = 0; + + if (loop_next == 1) + return 1; + + loop_next = 1; + return 0; +} + +int +main () +{ + char buffer[256]; + int ende = 0; + int index; + int local_base = 2; + + keywords.a = 1; + for (sy = 0;; sy++) + { + for (index = 1;;) + { + bar (buffer); + if (buffer[sy] != 0) + { + ende = 1; + break; + }; + if (foo (buffer)) + { + keywords.a += index - 1; + break; + } + index++; + } + if (ende) + break; + } + + subroutine_offset = 0; + + for (;;) + { + if (loop_next (&keywords_table, (char*)&keywords)) + break; + + if ((!memcmp (keywords.name, "+++", 3))) + local_base = 100; + else + local_base = 0; + + if ((!memcmp (keywords.name, "+++", 3))) + subroutine_offset += local_table; + + for (;;) + { + if (loop_next (&local_table, (char*)&local)) + break;; + if ((local.a == 0)) + continue;; + foo (local.name); + } + } + return 0; +} |