diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c new file mode 100644 index 000000000..59f81b756 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c @@ -0,0 +1,54 @@ +/* { dg-do link } */ +/* { dg-options "--param allow-store-data-races=0" } */ +/* { dg-final { simulate-thread } } */ + +#include <stdio.h> +#include <stdlib.h> + +#include "simulate-thread.h" + +/* PR 54139 */ +/* Test that speculative stores do not happen for --param + allow-store-data-races=0. */ + +int g_13=1, insns=1; + +__attribute__((noinline)) +void simulate_thread_main() +{ + int l_245; + + /* Since g_13 is unilaterally set positive above, there should be + no store to g_13 below. */ + for (l_245 = 0; l_245 <= 1; l_245 += 1) + for (; g_13 <= 0; g_13 = 1) + ; +} + +int main() +{ + simulate_thread_main (); + simulate_thread_done (); + return 0; +} + +void simulate_thread_other_threads () +{ + ++g_13; + ++insns; +} + +int simulate_thread_step_verify () +{ + return 0; +} + +int simulate_thread_final_verify () +{ + if (g_13 != insns) + { + printf("FAIL: g_13 was incorrectly cached\n"); + return 1; + } + return 0; +} |