Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Ranier Vilela <ranier.vf@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-04T03:01:54Z
Lists: pgsql-hackers
On Thu, Sep 3, 2020 at 7:53 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Hm. I would not blame that on -fdelete-null-pointer-checks per se. > Rather the problem is what we were touching on before: the dubious > but standard-approved assumption that memcpy's arguments cannot be > null. Isn't it both, together? That is, it's the combination of that assumption alongside -fdelete-null-pointer-checks's actual willingness to propagate the assumption. > I'd still leave -fdelete-null-pointer-checks > enabled, because it can make valid and useful optimizations in > other cases. Is there any evidence that that's true? I wouldn't assume that the gcc people exercised good judgement here. -- Peter Geoghegan
Commits
-
Avoid memcpy() with a NULL source pointer and count == 0
- f0ff52f25cb9 12.6 landed
- 677f74e5bb83 14.0 landed
- 5a1d1b9540a4 13.2 landed
- 49aaabdf8d0b 11.11 landed
-
Avoid calling memcpy() with a NULL source pointer and count == 0.
- 13bba02271dc 9.6.0 cited