Re: BUG #15121: Multiple UBSAN errors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, marxin(dot)liska(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15121: Multiple UBSAN errors
Date: 2019-06-30 18:52:44
Message-ID: 15737.1561920764@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Noah Misch <noah(at)leadboat(dot)com> writes:
> On Sun, Mar 18, 2018 at 09:02:59PM -0400, Tom Lane wrote:
>> What I think might be happening is that the compiler is taking the
>> fact that the pointer is declared as AnyArrayType *, where ...
>> to assume that the pointer must be aligned on an 8-byte boundary because
>> ExpandedArrayHeader would require that, even if we're only accessing the
>> "flt" member.

> Yep.

> Using different casts, as attached, silences these complaints without much
> change in code cosmetics.

I'd intentionally avoided using casts this way as an attempt to ensure
that these macros weren't accidentally applied to the wrong kind of
pointer. However, avoiding UBSAN complaints (and perhaps wrong code
generation) seems like a more important goal. This patch looks OK to me.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2019-07-01 02:14:47 Re: BUG #15383: Join Filter cost estimation problem in 10.5
Previous Message Andres Freund 2019-06-30 00:50:03 Re: ERROR: virtual tuple table slot does not have system attributes