[Patch] Make atomics work on FreeBSD+arm

Ed Schouten ed at 80386.nl
Fri May 31 12:04:50 PDT 2013


Hi Rafael,

2013/5/31 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:
> With this the user would get an undefined reference instead of a
> compiler error, no?

Well, yes/no. The __atomic_fetch_* functions can only be applied to
integer types. Poorly constructed example:

struct henk {
        char x[100];
};

int
main() {
        _Atomic(struct henk) piet;
        struct henk jan;

        __atomic_fetch_xor(&piet, jan, 5);
}

bla.c:10:2: error: first argument to bitwise atomic operation must be
a pointer to integer ('_Atomic(struct henk) *' invalid)

As we should in my opinion always support __atomic_fetch_* for all the
integer types available (and the number of integer types is rather
small), I'd rather not add explicit code to Clang to
whitelist/blacklist certain sizes.

Thoughts?

--
Ed Schouten <ed at 80386.nl>




More information about the cfe-commits mailing list