>
> "is it really the same type?"
>
A bit ambiguous wording. What I mean is that, for a naturally-aligned type
N, the corresponding call can be generated to routine __atomic_X_N. The
code generator doesn't need to care whether types in the _implementation_
of __atomic_X_N must literally match those passed; if the semantics match,
this is enough. And, indeed, the code below...
#include <stdatomic.h>
#include <stdint.h>
struct combo {
uint16_t lo;
uint16_t hi;
};
struct combo xchg(_Atomic(struct combo) *atom, struct combo value)
{
return atomic_exchange(atom, value);
}
...causes the compiler to generate the same code as if it operated on
uint32_t.
gcc and clang for x86 inline this code, and this is explicitly allowed by
the documentation, with some additional remarks.
It appears to me that the documentation speaks of code generation. We could
have emitted a call, and this also would have been OK.
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel