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);
         ^~~~~~~~~~~~~~~~~~~
```
This commit is contained in:
Oran Agra 2022-10-07 21:24:54 +03:00 committed by GitHub
parent 8e19415343
commit 34e70c13c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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)) {