Re: Spurious warnings in crypto-des.c when building with gcc-16 -O3

From: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Subject: Re: Spurious warnings in crypto-des.c when building with gcc-16 -O3
Date: 2026-08-19 15:34:41
Message-ID: 178715368119.1145.13475632692274534886.pgcf@coridan.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested

I have reviewed the patch and it looks good to me.

I have used following C simulated code to double-check code modification:

#include <stdio.h>
#include <stdint.h>

void code1() {
char *key = "1234567890ABCDEF";
uint32_t keybuf[2];
uint8_t *q;

int i = 0;
printf("code1:\n");

q = (uint8_t *)keybuf;

while (q - (uint8_t *) keybuf - 8)
{
printf("i=%d\n", i);
i++;
*q++ = *key << 1;
if (*key != '\0')
key++;
}

printf("\n");

i = 0;
while (*key)
{
/*
* And XOR with the next 8 characters of the key.
*/
q = (uint8_t *) keybuf;
while (q - (uint8_t *) keybuf - 8 && *key) {
printf("i=%d\n", i);
i++;
*q++ ^= *key++ << 1;
}
}

}

void code2() {
uint32_t keybuf[2];
size_t bytenum;

printf("code2:\n");

for (bytenum = 0; bytenum < sizeof(keybuf); bytenum++)
{
printf("bytenum=%ld\n", bytenum);
}

printf("\n");

char *key = "12345678";
uint8_t *q;
q = (uint8_t *)keybuf;

while (*key)
{
/*
* And XOR with the next 8 characters of the key.
*/
q = (uint8_t *) keybuf;
for (bytenum = 0;
bytenum < sizeof(keybuf) && *key;
bytenum++) {
printf("bytenum=%ld\n", bytenum);
*q++ ^= *key++ << 1;
}
}

}

int main(int argc, char **argv)
{
code1();
code2();
}

There is no SQL compliance to check and I don't think additional documentation is needed.

Regards
Pierre Forstmann

The new status of this patch is: Ready for Committer

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-08-19 15:58:33 Re: Failing assertion while taking a restartpoint during crash recovery
Previous Message Xuneng Zhou 2026-08-19 15:09:54 Re: timeout value overflow in wait for lsn