[PATCH v2 00/32] mpi: Sync longlong.h with GCC

Matt Turner mattst88 at gmail.com
Thu Nov 26 16:55:14 CET 2026


On Thu, Nov 26, 2026 at 5:58 AM Werner Koch <wk at gnupg.org> wrote:
>
> Hi!
>
> On Wed, 25 Nov 2026 15:19, Matt Turner said:
> > This is v2 of "mpi: Drop casts from inline asm output operands." [1],
> > which has grown into a series.
>
> Can you please briefly explain what bugs are solved by all these
> patches.
>
> The code is quite matured and has been tested over some decades on
> dozens of Unices (not just Linux and *BSD).  We can't run these tests
> again and would need to trust you and your AI tools that there won't be
> a regression.

Sure. My original goal was simply to make libgcrypt compile under
clang. It didn't, due to output casts on asm operands. As I said, I
fixed this in upstream GCC.

My v1 patch to libgcrypt was rejected because "We don't want further
differences of our own from upstream." As such, I take it as axiomatic
that it's beneficial to minimize unnecessary differences from GCC's
longlong.h. In many of the cases of differences, it's because
libgcrypt has not incorporated a bug fix GCC made, sometimes decades
ago.

For example (just restating what I said in the cover letter here...):

  - the SPARClite count_leading_zeros has its operands swapped, so it
   clobbers its argument and never sets the count (fixed in GCC in
   1998);
 - the NS32000, i960 and 88110 code does not compile at all;
 - 32-bit SPARC built for V9 falls back to the V7 mulscc loop and ends
   up with an undefined reference to __udiv_qrnnd;
 - the generic smul_ppmm initializes temporaries from themselves when
   umul_ppmm declares __m0 and __m1;
 - 31-bit s390 fails to build because __udiv_w_sdiv is never declared;
 - the 68060 and CPU32 get instructions they do not implement.

Each patch has an explanation of the problem its fixing and in many
cases a citation of the upstream (i.e. from GCC) commit that the patch
came from.

If you have specific concerns, I'm happy to address them. It's more
than a bit disheartening to have done this work and receive your very
uninterested reply.

Thanks,
Matt


More information about the Gcrypt-devel mailing list