pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Undefined behavior detected by new clang's ubsan
Date: Tue, 20 Jan 2026 13:52:08 -0500
Message-ID: <1710697.1768935128@sss.pgh.pa.us> (raw)
In-Reply-To: <CANWCAZZWvds_35nXc4vXD-eBQa_=mxVtqZf-PM_ps=SD7ghhJg@mail.gmail.com>
References: <777bd201-6e3a-4da0-a922-4ea9de46a3ee@gmail.com>
	<CANWCAZbm1cZyNAmV+f-GBD3pa3F=Nx6x85mH-c4eS=-2us3OjQ@mail.gmail.com>
	<7ea15f17-f001-4b5c-979d-b9cff4db46bb@gmail.com>
	<CANWCAZZWvds_35nXc4vXD-eBQa_=mxVtqZf-PM_ps=SD7ghhJg@mail.gmail.com>

John Naylor <johncnaylorls@gmail.com> writes:
> I don't think it's great to pass a NULL pointer to a sort, but the
> length could conceivably be zero for future degenerate cases, so we
> could silence the warning by adding "if (n < 2) return;" before the
> for-loop. The advantage of doing that anyway is it allows us to remove
> all four of the "if (d_ > ST_POINTER_STEP)" branches in the recursion
> part. That's better for readability.

+1

			regards, tom lane





view thread (12+ messages)  latest in thread

Message-ID: <1710697.1768935128@sss.pgh.pa.us>
Permalink:  ../1710697.1768935128@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1710697.1768935128@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, johncnaylorls@gmail.com, exclusion@gmail.com
  Subject: Re: Undefined behavior detected by new clang's ubsan
  In-Reply-To: <1710697.1768935128@sss.pgh.pa.us>
  References: <777bd201-6e3a-4da0-a922-4ea9de46a3ee@gmail.com> <CANWCAZbm1cZyNAmV+f-GBD3pa3F=Nx6x85mH-c4eS=-2us3OjQ@mail.gmail.com> <7ea15f17-f001-4b5c-979d-b9cff4db46bb@gmail.com> <CANWCAZZWvds_35nXc4vXD-eBQa_=mxVtqZf-PM_ps=SD7ghhJg@mail.gmail.com> <1710697.1768935128@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox