From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Mathew Heard <mat999(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar |
Date: | 2025-03-14 01:45:39 |
Message-ID: | 2962250.1741916739@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> The configure script isn't "identifying" anything. It's just seeing
> whether references to __crc32cb() etc will compile with different
> -march flags. It's not apparent why a successful test of that sort
> would not lead to a successful compilation with the same flags later
> on.
Actually ... looking harder at the test code, perhaps I see a way.
We're testing this:
unsigned int crc = 0;
crc = __crc32cb(crc, 0);
crc = __crc32ch(crc, 0);
crc = __crc32cw(crc, 0);
crc = __crc32cd(crc, 0);
/* return computed value, to prevent the above being optimized away */
return crc == 0;
but that "prevent the above being optimized away" looks mighty leaky.
Specifically, there's nothing stopping the compiler from folding all
these CRC calls to constants, since the input is constant. So in
an environment where the compiler knows these functions but glibc
doesn't have them, perhaps we could get a false pass --- and then
the real code with non-constant inputs could fail?
I'm not very convinced of this theory, because I checked with gcc
12.2.0 and it wouldn't do that even at max -O level. But maybe
your compiler is different. Could you try the attached patch
for configure and see if it arrives at the right conclusions?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
prevent-constant-folding-in-CRC-probes.patch | text/x-diff | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2025-03-14 02:48:29 | Re: BUG #18830: ExecInitMerge Segfault on MERGE |
Previous Message | Tom Lane | 2025-03-14 01:08:56 | Re: BUG #18839: ARMv7 builds fail due to missing __crc32cw and similar |