Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.dg/simulate-thread/strict-align-global.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* { dg-do link } */ /* { dg-final { simulate-thread } } */ #include <stdio.h> #include "simulate-thread.h" /* This test verifies writes to globals do not write to adjacent globals. This mostly happens on strict-align targets that are not byte addressable (old Alphas, etc). */ char a = 0; char b = 77; void simulate_thread_other_threads() { } int simulate_thread_step_verify() { if (b != 77) { printf("FAIL: Unexpected value. <b> is %d, should be 77\n", b); return 1; } return 0; } /* Verify that every variable has the correct value. */ int simulate_thread_final_verify() { int ret = simulate_thread_step_verify (); if (a != 66) { printf("FAIL: Unexpected value. <a> is %d, should be 66\n", a); return 1; } return ret; } __attribute__((noinline)) void simulate_thread_main() { a = 66; } int main () { simulate_thread_main(); simulate_thread_done(); return 0; }