Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1k8e-000ZER-26 for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 12:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1k8d-004Jgj-2W for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Mar 2026 12:00:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1k8d-004Jgb-1U for pgsql-hackers@lists.postgresql.org; Sun, 15 Mar 2026 12:00:08 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w1k8c-00000000EwB-0LHH for pgsql-hackers@postgresql.org; Sun, 15 Mar 2026 12:00:07 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4853aec185aso29992055e9.1 for ; Sun, 15 Mar 2026 05:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773576003; x=1774180803; darn=postgresql.org; h=content-transfer-encoding:cc:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=hHyw2yPPMnrz80FM35+fqe2XsWlJWfrW8B5Jfq9cC7M=; b=N/MYXCBGWb/Wo6HgmU0X+Lp1Qt+wNLD3eCX3U5dTAlHt7ojug5d59KcynBhm68Rb8D FD+spllrJTt+CZZACSaNMCR+iD4vDJw2F1QsKj77STcqdcQ1ONUvBfcG+PSZknKtmYeO Pnu2okt9pupnL8k+7sLgQdDSp3EtTsNbON7HyxAJ7P1igPtmclYWhoxpIngrvE6OnTBd D9pJBLzRoybhWwyk1PvJtwwVyMdq913Lrn9q0Mb9t4jO26lsDl9IGDnBH4fsF62f8JUD qzAtEci+rw5OmZY2M/WznqfDbMvuIJW5G2ydkc5JPE2Bprr3ry/xaKi80O7VEKeWEsYu SZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773576003; x=1774180803; h=content-transfer-encoding:cc:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hHyw2yPPMnrz80FM35+fqe2XsWlJWfrW8B5Jfq9cC7M=; b=sJuMTpGqTItOEshicJQbG2QGgsKxDAxowlaP8zwpgOyZ/3QsoKUSDDY/9RkRqROU/A PX5x1d2s/lyhS0W0uviwHNcB5sPPlPCOVvtJiPXG9R0GBU6jOCWD1NNILWxVHcleWcos rFMnHqIgESrfkmuborPs/9GC6JsWDEPz1672FgHvHCL+UrzAmB5ifaFYPfhmCqsbQ+TH JAXL6lRSOeM20Qk8cecmCZwVZyqwzyPxB8NRcb6Ra7H1S3IwpCgSZf2iIyybvkvcgyAm j9gN+SZs6d1JPR16tJcZzEFFdD4QP9Au/W330/Vh/kQcW6H0BWhsjYxVVxsx5aih8t0u 3paQ== X-Gm-Message-State: AOJu0Yx+WM0GyIHpSNj/VlBmrznNHtwXqaWkM+aPlhoNpFJzJchDWJQR UtD3qetwbzLxZzINeISN8oumMKipIjxQlN/pYN05pdfkd4T6suAT2KkEv08Qtg== X-Gm-Gg: ATEYQzw1HkovG/rAKYiKPhMsMbjDbdbl8ui5ywxQF/PoH3j7CmDSMi3Pjunm8CKMYDZ j8FCtb+uK9XU0Scu4tjJgPZAaSp5uI83Fvu08h6AjZRhbCCnKO/9MM/yyoi5yollBNgiEJhbj1i xVLJHzxJtc6w4M7TNTvSXK2OZEfCFniMoVlcj4cZ8u90YhvXDUGzBErbFy9Vht9TZj+HPvCwkcs zOrx1XqSeWmNwXUgx3t7JruSWdkmEv6OCpQKE+fED+1jRUupoWwHyGOxO1IF6nOtqnv4ntt6sIG o2s2KpEC/FwFJw4L7ezVjeM8BxOMrr5Bcftu8HCZPVKQjgLG2maAnhBXIKyXh7l1yBpYeG/4l0O 23IyczBMq9DH0XVvgHMzyynfTWA7uU/jfjVwQAVkRJrQrZmz+8gcP5T3H5+Zy1efQBm/+jdpXf0 VSCU/bfrenhdUaadNm4Ztl6LTE X-Received: by 2002:a05:600c:8488:b0:477:a1a2:d829 with SMTP id 5b1f17b1804b1-485566d5162mr148011105e9.13.1773576003125; Sun, 15 Mar 2026 05:00:03 -0700 (PDT) Received: from [192.168.0.50] ([89.149.93.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48557a738easm85100425e9.16.2026.03.15.05.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Mar 2026 05:00:02 -0700 (PDT) Message-ID: Date: Sun, 15 Mar 2026 14:00:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-hackers From: Alexander Lakhin Subject: pgcrypto/des tests fail on riscv64 due to clang's code generation anomaly Cc: Greg Burd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello hackers, As recent failures from greenfly, e.g. [1], show: --- /home/gburd/build/HEAD/pgsql/contrib/pgcrypto/expected/crypt-des.out 2026-03-13 18:06:10.669824704 +0000 +++ /home/gburd/build/HEAD/pgsql.build/testrun/pgcrypto/regress/results/crypt-des.out 2026-03-13 18:38:39.830105127 +0000 @@ -4,13 +4,13 @@  SELECT crypt('', 'NB');       crypt  --------------- - NBPx/38Y48kHg + NB3TsPvodZDgs  (1 row) adding -march=rv64gcv to CFLAGS makes clang generate different (wrong?) code for crypt-des.c. Namely, having reproduced the diff locally, with this debugging addition: --- a/contrib/pgcrypto/crypt-des.c +++ b/contrib/pgcrypto/crypt-des.c @@ -355,6 +355,11 @@ des_init(void)      for (i = 0; i < 32; i++)          un_pbox[pbox[i] - 1] = i; +fprintf(stderr, "!!!des_init| un_pbox:"); +    for (i = 0; i < 32; i++) +        fprintf(stderr, " %d", un_pbox[i]); +fprintf(stderr, "\n"); +      for (b = 0; b < 4; b++) I can see the following during a normal execution of: CREATE EXTENSION pgcrypto; SELECT crypt('', 'NB');      crypt ---------------  NBPx/38Y48kHg !!!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 vs:      crypt ---------------  NB3TsPvodZDgs !!!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 when the code compiled with CC=clang-20 CPPFLAGS="-march=rv64gcv". I don't observe this issue with gcc-14, nor with this modification (using clang-20, -march=rv64gcv):         for (i = 0; i < 32; i++) +{                 un_pbox[pbox[i] - 1] = i; +pg_compiler_barrier(); +} [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=greenfly&dt=2026-03-13%2018%3A06%3A09 Best regards, Alexander