Re: pgcrypto/des tests fail on riscv64 due to clang's code generation anomaly

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Greg Burd <greg(at)burd(dot)me>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: pgcrypto/des tests fail on riscv64 due to clang's code generation anomaly
Date: 2026-03-16 18:00:00
Message-ID: f1a8853e-b0d4-4e7c-a7b3-b8238dedd272@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

16.03.2026 14:13, Greg Burd wrote:
>> Seems like this might be worth a bug report to the clang people.
> Thanks Alexander for digging and a solid report of the issue, and Michael for spending some time on this, and Tom for chiming in as well. I agree this looks like a compiler issue. I know that Thomas (added/CC'ed) you've posted bugs against clang before, any thoughts on this one?
>

Please find attached the reduced test code, which works for me as follows:
$ clang-20 -O2 -march=rv64gcv crypt-des-test.c -o crypt-des-test && ./crypt-des-test
!!!des_init| un_pbox: 15 6 19 20 28 11 27 16 0 14 22 25 4 17 30 9 1 7 23 13 31 26 2 8 18 12 29 5 21 10 3 24

$ clang-20 -O2 -march=rv64gc crypt-des-test.c -o crypt-des-test && ./crypt-des-test
!!!des_init| un_pbox: 8 16 22 30 12 27 1 17 23 15 29 5 25 19 9 0 7 13 24 2 3 28 10 18 31 11 21 6 4 26 14 20

$ clang-20 -O1 -march=rv64gcv crypt-des-test.c -o crypt-des-test && ./crypt-des-test
!!!des_init| un_pbox: 8 16 22 30 12 27 1 17 23 15 29 5 25 19 9 0 7 13 24 2 3 28 10 18 31 11 21 6 4 26 14 20

$ clang-20 --version
Ubuntu clang version 20.1.2 (0ubuntu1~24.04.2)

Best regards,
Alexander

Attachment Content-Type Size
crypt-des-test.c text/x-csrc 741 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-03-16 18:08:30 Re: Read-only connection mode for AI workflows.
Previous Message Jeff Davis 2026-03-16 17:55:26 Re: Expanding HOT updates for expression and partial indexes