Avoid memcpy() with a NULL source pointer and count == 0 When memcpy() is called on a pointer, the compiler is entitled to assume that the pointer is not null, which can lead to optimizing nearby code in potentially undesirable ways. We still want such optimizations (gcc's -fdelete-null-pointer-checks) in cases where they're valid.
Related: commit 13bba02271dc. Backpatch to pg11, where this particular instance appeared. Reported-by: Ranier Vilela <[email protected]> Reported-by: Zhihong Yu <[email protected]> Discussion: https://postgr.es/m/caeudqapundmqkr5flrckxq7+ib44i7s+kk93pyvths85png...@mail.gmail.com Discussion: https://postgr.es/m/calnj-vsdhwsm5f4tnnn1cdlhvxmve_s+v3nr5gwnrmcpnb2...@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5a1d1b9540a4f5bf4ee6761a17b21ad7c0012b49 Modified Files -------------- src/backend/commands/indexcmds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
