Re: BUG #15121: Multiple UBSAN errors
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Noah Misch <noah@leadboat.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>, marxin.liska@gmail.com,
pgsql-bugs@lists.postgresql.org
Date: 2019-06-30T18:52:44Z
Lists: pgsql-bugs
Noah Misch <noah@leadboat.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
Commits
-
Don't read fields of a misaligned ExpandedObjectHeader or AnyArrayType.
- b664b187d7ea 9.5.19 landed
- cd9d48969d94 10.10 landed
- 4b85f20f948d 11.5 landed
- 2938aa2a5b1c 9.6.15 landed
- 459c3cdb4ad8 12.0 landed
-
Doc: note that statement-level view triggers require an INSTEAD OF trigger.
- a46783204713 11.0 cited