Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aliasing violations in CAS2 operations #46

Open
sbahra opened this issue Aug 4, 2015 · 0 comments
Open

Fix aliasing violations in CAS2 operations #46

sbahra opened this issue Aug 4, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@sbahra
Copy link
Member

sbahra commented Aug 4, 2015

This has been around forever, and compilers will complain. Quick fix and localized. Problem code is below (which most CAS2 operations are built on).

CK_CC_INLINE static bool
ck_pr_cas_64_2(uint64_t target[2], uint64_t compare[2], uint64_t set[2])
{
        bool z;

        __asm__ __volatile__("movq 0(%4), %%rax;"
                             "movq 8(%4), %%rdx;"
                             CK_PR_LOCK_PREFIX "cmpxchg16b %0; setz %1"
                                : "+m" (*target),
                                  "=q" (z)
                                : "b"  (set[0]),
                                  "c"  (set[1]),
                                  "q"  (compare)
                                : "memory", "cc", "%rax", "%rdx");
        return z;
}

Other CAS2 variants affected.

@sbahra sbahra added the bug label Aug 4, 2015
@sbahra sbahra self-assigned this Aug 4, 2015
@sbahra sbahra added this to the 0.5.0 milestone Oct 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant