Re: Invalid control file checksum with AVX-512 during initdb on a clang19 -O0 build

From: Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Invalid control file checksum with AVX-512 during initdb on a clang19 -O0 build
Date: 2025-06-12 17:30:08
Message-ID: CAE-ML+_9D3q_TsXa+eG3Nn69UmzDHrVoHccxMB5C8xWdNfU8MA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jun 11, 2025 at 11:57PM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>
> On Thu, Jun 12, 2025 at 4:42AM Nathan Bossart <nathandbossart(at)gmail(dot)com>
wrote:
> >
> > (I've CC'd the committer of the feature.)
> >
> > On Wed, Jun 11, 2025 at 11:10:31AM -0700, Soumyadeep Chakraborty wrote:
> > > Note that this only reproduces with clang-19 -O0 and NOT -O3. I
haven't
> > > tried with other versions of clang.
> > >
> > > OTOH, gcc-14 is cool with both -O0 and -O3, with AVX-512 getting
picked
> > > for both cases, for CRC instructions.
> >
> > I'm wondering if there's anything else this could be besides a compiler
> > bug. It's interesting that -O0 is the broken case. Have you tried
looking
> > for differences in the assembly code?

Unfortunately, I haven't had a chance to dig into the assembly yet.

>
> Hmm, clang at -O0 is the same in versions 18, 19, and 20. The change
> from v17 is easy enough to workaround as in the attached, which
> produces identical output as master at -O2. Does this fix it for you?
> If that's not it, it may be more difficult, as the change at -O0 from
> v16 to v17 is large, so it's hard to see what's going on.
>

It unfortunately doesn't. I still get the same checksum failure. I tried
-O0 clang-19, clang-18 and clang-17. I've uploaded the rr recordings
and initdb output with your patch applied and the debug logs I had.

Regards,
Deep

initdb-clang17.crc.workaround.out
<https://drive.google.com/file/d/1OptFhlWsOqNx4s2fv1tikOhsqjh27u-E/view?usp=drive_web>
initdb-clang18.crc.workaround.out
<https://drive.google.com/file/d/1yXYWmt7cHMXgONMkr9Yl29YU2HXpE8LT/view?usp=drive_web>
initdb-clang19.crc.workaround.out
<https://drive.google.com/file/d/1JmLKQMXOCwx8YFlJ_xpKdniopjwGpcji/view?usp=drive_web>
rr-clang17.crc.workaround.tar.gz
<https://drive.google.com/file/d/1Tnjva4l4w6S6iKn2hJBaTy1NRNHTTsAV/view?usp=drive_web>
rr-clang18.crc.workaround.tar.gz
<https://drive.google.com/file/d/1m7iKJHcAPPcKXet9gKkGEzTiFbJ2C9Ul/view?usp=drive_web>
rr-clang19.crc.workaround.tar.gz
<https://drive.google.com/file/d/1zXzUtvMJbsNMJNQezI5uC3Fb8Y3sUuMs/view?usp=drive_web>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-06-12 21:50:12 Re: BUG #18953: Planner fails to build plan for complex query with LATERAL references
Previous Message Fujii Masao 2025-06-12 14:27:12 Re: BUG #18952: pg_restore --help and document have strange description: Dump something