This is likely a bug, but compiler allows it:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_redis/redis/work/compwrap/cc/opt/local/bin/gcc-mp-14 -pedantic -DREDIS_STATIC='' -std=gnu11 -Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations -Wstrict-prototypes -O3 -flto=auto -fno-omit-frame-pointer -g -ggdb -arch ppc -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/fpconv -DUSE_JEMALLOC -I../deps/jemalloc/include -DUSE_OPENSSL=1 -DBUILD_TLS_MODULE=0 -MMD -o redis-benchmark.o -c redis-benchmark.c
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_redis/redis/work/compwrap/cc/opt/local/bin/gcc-mp-14 -Wl,-headerpad_max_install_names -latomic -L/opt/local/lib -lMacportsLegacySupport -arch ppc -O3 -flto=auto -fno-omit-frame-pointer -g -ggdb -o redis-server threads_mngr.o adlist.o quicklist.o ae.o anet.o dict.o ebuckets.o mstr.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/fpconv/libfpconv.a ../deps/jemalloc/lib/libjemalloc.a -lm -ldl ../deps/hiredis/libhiredis_ssl.a -L/opt/local/libexec/openssl3/lib -lssl -L/opt/local/libexec/openssl3/lib -lcrypto
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_databases_redis/redis/work/compwrap/cc/opt/local/bin/gcc-mp-14 -Wl,-headerpad_max_install_names -latomic -L/opt/local/lib -lMacportsLegacySupport -arch ppc -O3 -flto=auto -fno-omit-frame-pointer -g -ggdb -o redis-benchmark ae.o anet.o redis-benchmark.o adlist.o dict.o zmalloc.o redisassert.o release.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a ../deps/jemalloc/lib/libjemalloc.a -lm -ldl ../deps/hiredis/libhiredis_ssl.a -L/opt/local/libexec/openssl3/lib -lssl -L/opt/local/libexec/openssl3/lib -lcrypto
In function '__inline_memcpy_chk',
inlined from 'zipmapSet' at zipmap.c:253:5:
/usr/include/secure/_string.h:58:10: warning: '__builtin_memcpy' writing 254 or more bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
58 | return __builtin___memcpy_chk (__dest, __src, __len, __darwin_obsz0(__dest));
| ^
In function 'zipmapSet':
lto1: note: destination object is likely at address zero
Comment From: sundb
feels like a false positive, i can't see that p can be NULL (address zero) here.
what is your environment and build chain?
Comment From: barracuda156
feels like a false positive, i can't see that
pcan be NULL (address zero) here. what is your environment and build chain?
This is on a 32-bit platform (10.6 / ppc) with gcc-14.2.0.
Comment From: sundb
@barracuda156 anyway, zipmapSet is dead code now and doesn't cause any bugs.
we can let it go unless you can prove it's not a false positive. 😄
Comment From: barracuda156
@sundb Thank you, I can rely on your opinion here. Should we close this then?
Comment From: sundb
@barracuda156 i thnk so.