Inline assembly needs "cc" clobber to avoid miscompilation

Torbjörn Granlund tg at
Sat Nov 23 18:06:22 UTC 2019

I used a few more hours of my time on this.

My conclusion is that "cc" clobber is completely ignored by clang.  In
fact, clang happily schedules carry-set and carry-use around inline asm
with "cc".

This is another example that it's just a waste time trying to make GMP
compile reliably with clang.  See also Table 3 and the list below that
table at for some context.

Perhaps we could help clang's users by disabling GMP's inline asm
altogether.  It make things run a bit slower, but correctness is not
optional, speed is.  (We never enabled inline asm, it got enabled since
clang claims to be gcc.)

Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list