Skip to content

Clang uses wrong ABI for __atomic_store_16 on Windows #136428

Open
@Alcaro

Description

@Alcaro
unsigned __int128 g;
extern "C" void k(unsigned __int128* a, unsigned __int128 b, int c);
extern "C" void r()
{
    k(&g, 1234, 5);
}
extern "C" void p()
{
    __atomic_store_n(&g, 1234, __ATOMIC_SEQ_CST);
}

Expected: Pass the int128 by reference, and place __ATOMIC_SEQ_CST=5 in r8d, for both calls, like GCC.

Actual: Clang calls __atomic_store_16 by passing the int128 by value in r8:rdx, and the 5 goes in r9d. https://godbolt.org/z/49Gzso4ax

Originally reported by @progmachine at brechtsanders/winlibs_mingw#256

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary InterfaceclangClang issues not falling into any other categoryplatform:windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions