[Bug 230888] Missing 64 bit atomic functions for i386 (libatomic)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Sep 10 16:20:09 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230888

--- Comment #36 from Tijl Coosemans <tijl at FreeBSD.org> ---
(In reply to Dimitry Andric from comment #35)
The calls are expanded because of casts.  So for instance a uint64_t* parameter
is cast to _Atomic(uint64_t)*.  This is problematic because _Atomic(uint64_t)
can be an 8 byte aligned type which causes compiler_rt to use instructions as
if a given address is 8 byte aligned while it can be completely misaligned. 
Here's some example code where clang generates a library call because of
misalignment.

struct foo {
        char c;
        _Atomic(long long) ll;
} __attribute__((__packed__));

long long
test(struct foo *f) {
        return (f->ll);
}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-toolchain mailing list