The branch stable/12 has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=13ecd510decfec102ec8513a4fb239be4df33f2e

commit 13ecd510decfec102ec8513a4fb239be4df33f2e
Author:     Ryan Libby <rli...@freebsd.org>
AuthorDate: 2019-12-21 02:44:38 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2023-03-22 00:00:51 +0000

    jemalloc: pick from upstream: Fix GCC-9.1 warning with macro GET_ARG_NUMERIC
    
    Pick 2d6d099fed05b1509e81e54458516528bfbbf38d from upstream jemalloc:
    
        Fix GCC-9.1 warning with macro GET_ARG_NUMERIC
    
        GCC-9.1 reports following error when trying to compile file
        src/malloc_io.c and with CFLAGS='-Werror' :
    
        src/malloc_io.c: In function ‘malloc_vsnprintf’:
        src/malloc_io.c:369:2: error: case label value exceeds maximum value 
for type [-Werror]
          369 |  case '?' | 0x80:      \
              |  ^~~~
        src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
          581 |     GET_ARG_NUMERIC(val, 'p');
              |     ^~~~~~~~~~~~~~~
        ...
        <snip>
        cc1: all warnings being treated as errors
        make: *** [Makefile:388: src/malloc_io.sym.o] Error 1
    
        The warning is reported as by default the type 'char' is 'signed char'
        and or-ing 0x80 will turn the case label char negative which will be
        beyond the printable ascii range (0 - 127).
    
        The patch fixes this by explicitly casting the 'len' variable as
        unsigned char' inside the 'switch' statement so that value of
        expression " '?' | 0x80 " falls within the legal values of the
        variable 'len'.
    
    Discussed with: jasone (maintainer)
    Sponsored by:   Dell EMC Isilon
    
    (cherry picked from commit 79457a8ad150d784f6c02c5e65e8b75c6836e651)
---
 contrib/jemalloc/src/malloc_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/jemalloc/src/malloc_io.c b/contrib/jemalloc/src/malloc_io.c
index c8802c700310..8ca9dbdb3089 100644
--- a/contrib/jemalloc/src/malloc_io.c
+++ b/contrib/jemalloc/src/malloc_io.c
@@ -376,7 +376,7 @@ malloc_vsnprintf(char *str, size_t size, const char 
*format, va_list ap) {
        }                                                               \
 } while (0)
 #define GET_ARG_NUMERIC(val, len) do {                                 \
-       switch (len) {                                                  \
+       switch ((unsigned char)len) {                                   \
        case '?':                                                       \
                val = va_arg(ap, int);                                  \
                break;                                                  \

Reply via email to