<div dir="ltr"><div dir="ltr">On Sun, 6 Sep 2020 at 12:30, Stefan Kanthak via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">STOP POSTING HTML!<br></blockquote><div><br></div><div>Please don't come into our mailing list and post rude messages and demand that we conform to your expectations of mailing list etiquette. HTML mails are fine here. Your repeated rude comments are not. Please take a minute to decide whether you want to participate in our community or not; if you do, please try to follow our communication norms.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Le 5 sept. 2020 à 23:42, Stefan Kanthak <<a href="mailto:stefan.kanthak@nexgo.de" target="_blank">stefan.kanthak@nexgo.de</a>> a écrit :<br>
<br>
[...]<br>
<br>
> The clang version is fine,<br>
<br>
WRONG: it violates the MS-ABI!<br></blockquote><div><br></div><div>No, it doesn't. The __int128 type is a clang extension, and as such the MS ABI specification does not cover its ABI. If you want ABI compatibility between two compilers, you need to use the same types in both cases. You didn't -- you used __int128 on the Clang side and a struct on the MS ABI side -- so you broke the rules, and you can't expect ABI compatibility.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Remember: it's clang that claims to be compatible with a specification<br>
written and implemented by Microsoft!<br>
<br>
> this the the MSVC version that define a type using a compiler reserved name and make<br>
> assumptions about it.<br>
<br>
ARGH, again: MSVC is not the problem here, but clang!<br>
It doesn't matter whether the user-defined type is named __uint128_t or dummy,<br>
MSVC generates exactly the same code, ALWAYS:<br>
<br>
--- clang-bug-demo.c ---<br>
#ifndef __clang__<br>
typedef struct {<br>
    unsigned __int64 low;<br>
    unsigned __int64 high;<br>
} dummy;<br>
#else<br>
#define dummy __uint128_t<br>
__attribute__((ms_abi))<br>
#endif<br>
dummy __udivmodti4(dummy dividend, dummy divisor, dummy *remainder) {<br>
    if (remainder != 0)<br>
        *remainder = divisor;<br>
    return dividend;<br>
}<br>
--- EOF ---<br>
<br>
>> Again: start to read what I already posted!<br>
>> I use clang's own __uint128_t data type and show the assembly it generates,<br>
>> which is but INCOMPATIBEL with the MS-ABI.<br>
><br>
> And this is perfectly legit.<br>
<br>
WRONG!<br>
<br>
> As the MS-ABI does not support the __int128 type, using it with MSVC is an undefined behaviour.<br>
<br>
The MS-ABI supports user-defined types.</blockquote><div><br></div><div>As has been explained, __int128 is not a user-defined type. It's a scalar integer type.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">And specifies EXPLICITLY how to<br>
handle them when used as return value that doesn't fit in RAX..<br>
clang claims to be compatible, but this is a BLATANT LIE!<br>
<br>
Stefan<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>