diff options
author | Oran Agra <oran@redislabs.com> | 2022-10-07 21:24:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 21:24:54 +0300 |
commit | 34e70c13c99cdd2419610443ae84287a3080d54c (patch) | |
tree | 43171b54d6b0a5bb663be060c48deccb416508b3 | |
parent | 8e1941534388101f7e936bdf1126eda0036eb9fe (diff) | |
download | redis-34e70c13c99cdd2419610443ae84287a3080d54c.tar.gz |
fix arm build warning due to new compiler optimizations (#11362)
Build fails with warnings in ARM CI after adding more aggressive optimizations (#11350)
probably a result of more aggressive inlining
```
ziplist.c: In function ‘pop.constprop’:
ziplist.c:1770:13: error: ‘vlong’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf("%lld", vlong);
^~~~~~~~~~~~~~~~~~~~~
```
```
listpack.c: In function ‘lpInsert.constprop’:
listpack.c:406:9: error: argument 2 null where non-null expected [-Werror=nonnull]
memcpy(buf+1,s,len);
^~~~~~~~~~~~~~~~~~~
```
-rw-r--r-- | src/listpack.c | 4 | ||||
-rw-r--r-- | src/ziplist.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/listpack.c b/src/listpack.c index 7fe86d297..479ab097d 100644 --- a/src/listpack.c +++ b/src/listpack.c @@ -882,8 +882,10 @@ unsigned char *lpInsert(unsigned char *lp, unsigned char *elestr, unsigned char if (!delete) { if (enctype == LP_ENCODING_INT) { memcpy(dst,eleint,enclen); - } else { + } else if (elestr) { lpEncodeString(dst,elestr,size); + } else { + redis_unreachable(); } dst += enclen; memcpy(dst,backlen,backlen_size); diff --git a/src/ziplist.c b/src/ziplist.c index 9fa94bf1f..c3aa65633 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -1754,7 +1754,7 @@ static void stress(int pos, int num, int maxsize, int dnum) { static unsigned char *pop(unsigned char *zl, int where) { unsigned char *p, *vstr; unsigned int vlen; - long long vlong; + long long vlong = 0; p = ziplistIndex(zl,where == ZIPLIST_HEAD ? 0 : -1); if (ziplistGet(p,&vstr,&vlen,&vlong)) { |