From bcecb8a916260a016a569387c073060a266f02dd Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sun, 1 Apr 2018 23:30:56 +0200 Subject: [PATCH] gcc/ck_pr: Fix ck_pr_md_load_ptr() and ck_pr_md_store_ptr(). In an attempt to prevent gcc from emiting warnings, ck_pr_md_load_ptr and ck_pr_md_store_ptr were made wrong in commit 5ae12a19d01500b8307e11d18ab31f42b697e99b. load_ptr would return target instead of *target, and store would store the value in target instead of in *target. This is an attempt at fixing this, while still trying to avoid warnings. --- include/gcc/ck_pr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gcc/ck_pr.h b/include/gcc/ck_pr.h index 084d423..108e983 100644 --- a/include/gcc/ck_pr.h +++ b/include/gcc/ck_pr.h @@ -80,7 +80,7 @@ ck_pr_md_load_ptr(const void *target) void *r; ck_pr_barrier(); - r = CK_CC_DECONST_PTR(CK_PR_ACCESS(target)); + r = CK_CC_DECONST_PTR(*(volatile void *const*)(target)); ck_pr_barrier(); return r; @@ -91,7 +91,7 @@ ck_pr_md_store_ptr(void *target, const void *v) { ck_pr_barrier(); - CK_PR_ACCESS(target) = CK_CC_DECONST_PTR(v); + *(volatile void **)target = CK_CC_DECONST_PTR(v); ck_pr_barrier(); return; }