* lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125
@ 2026-09-10 22:07 kernel test robot
2026-09-10 22:35 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-09-10 22:07 UTC (permalink / raw)
To: Kuan-Wei Chiu
Cc: llvm, oe-kbuild-all, linux-kernel, Andrew Morton,
Linux Memory Management List, Guan-Chun Wu, David Laight
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 50d05c7c76c96b90462f24debacca971d2e86713
commit: c4eb7ad32eab13ba64cc452c6f43d518b63f5e03 lib/base64: optimize base64_decode() with reverse lookup tables
date: 10 months ago
config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project d3db069999553568848400c84cbf815c03f5470f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: c4eb7ad32eab ("lib/base64: optimize base64_decode() with reverse lookup tables")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609110514.S0a0FD6a-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 [-Wconstant-conversion]
58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
| ^~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
| ~
49 | [0 ... 0x1f] = -1, \
50 | INIT_32(0x20, ch_62, ch_63), \
51 | INIT_32(0x40, ch_62, ch_63), \
52 | INIT_32(0x60, ch_62, ch_63), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:46:50: note: expanded from macro 'INIT_32'
46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:45:49: note: expanded from macro 'INIT_16'
45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
lib/base64.c:43:48: note: expanded from macro 'INIT_4'
43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:42:48: note: expanded from macro 'INIT_2'
42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:34:42: note: expanded from macro 'INIT_1'
34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
| ~~~~~~~~~~^~~~
lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 130 to -126 [-Wconstant-conversion]
58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
| ^~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
| ~
49 | [0 ... 0x1f] = -1, \
50 | INIT_32(0x20, ch_62, ch_63), \
51 | INIT_32(0x40, ch_62, ch_63), \
52 | INIT_32(0x60, ch_62, ch_63), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:46:50: note: expanded from macro 'INIT_32'
46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:45:49: note: expanded from macro 'INIT_16'
45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
lib/base64.c:43:48: note: expanded from macro 'INIT_4'
43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:42:24: note: expanded from macro 'INIT_2'
42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:34:42: note: expanded from macro 'INIT_1'
34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
| ~~~~~~~~~~^~~~
lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 129 to -127 [-Wconstant-conversion]
58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
| ^~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
| ~
49 | [0 ... 0x1f] = -1, \
50 | INIT_32(0x20, ch_62, ch_63), \
51 | INIT_32(0x40, ch_62, ch_63), \
52 | INIT_32(0x60, ch_62, ch_63), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:46:50: note: expanded from macro 'INIT_32'
46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:45:49: note: expanded from macro 'INIT_16'
45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
lib/base64.c:43:24: note: expanded from macro 'INIT_4'
43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:42:48: note: expanded from macro 'INIT_2'
42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:34:42: note: expanded from macro 'INIT_1'
34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
| ~~~~~~~~~~^~~~
lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Wconstant-conversion]
58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
| ^~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
| ~
49 | [0 ... 0x1f] = -1, \
50 | INIT_32(0x20, ch_62, ch_63), \
51 | INIT_32(0x40, ch_62, ch_63), \
52 | INIT_32(0x60, ch_62, ch_63), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:46:50: note: expanded from macro 'INIT_32'
46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/base64.c:45:49: note: expanded from macro 'INIT_16'
45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
lib/base64.c:43:24: note: expanded from macro 'INIT_4'
43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
vim +58 lib/base64.c
47
48 #define BASE64_REV_INIT(ch_62, ch_63) { \
49 [0 ... 0x1f] = -1, \
50 INIT_32(0x20, ch_62, ch_63), \
51 INIT_32(0x40, ch_62, ch_63), \
52 INIT_32(0x60, ch_62, ch_63), \
53 [0x80 ... 0xff] = -1 }
54
55 static const s8 base64_rev_maps[][256] = {
56 [BASE64_STD] = BASE64_REV_INIT('+', '/'),
57 [BASE64_URLSAFE] = BASE64_REV_INIT('-', '_'),
> 58 [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
59 };
60
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125
2026-09-10 22:07 lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 kernel test robot
@ 2026-09-10 22:35 ` Nathan Chancellor
2026-09-11 6:41 ` Kuan-Wei Chiu
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-09-10 22:35 UTC (permalink / raw)
To: kernel test robot
Cc: Kuan-Wei Chiu, llvm, oe-kbuild-all, linux-kernel, Andrew Morton,
Linux Memory Management List, Guan-Chun Wu, David Laight
On Fri, Sep 11, 2026 at 06:07:30AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 50d05c7c76c96b90462f24debacca971d2e86713
> commit: c4eb7ad32eab13ba64cc452c6f43d518b63f5e03 lib/base64: optimize base64_decode() with reverse lookup tables
> date: 10 months ago
> config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/config)
> compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project d3db069999553568848400c84cbf815c03f5470f)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Fixes: c4eb7ad32eab ("lib/base64: optimize base64_decode() with reverse lookup tables")
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202609110514.S0a0FD6a-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 [-Wconstant-conversion]
> 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> | ~
> 49 | [0 ... 0x1f] = -1, \
> 50 | INIT_32(0x20, ch_62, ch_63), \
> 51 | INIT_32(0x40, ch_62, ch_63), \
> 52 | INIT_32(0x60, ch_62, ch_63), \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> lib/base64.c:43:48: note: expanded from macro 'INIT_4'
> 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:42:48: note: expanded from macro 'INIT_2'
> 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> | ~~~~~~~~~~^~~~
> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 130 to -126 [-Wconstant-conversion]
> 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> | ~
> 49 | [0 ... 0x1f] = -1, \
> 50 | INIT_32(0x20, ch_62, ch_63), \
> 51 | INIT_32(0x40, ch_62, ch_63), \
> 52 | INIT_32(0x60, ch_62, ch_63), \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> lib/base64.c:43:48: note: expanded from macro 'INIT_4'
> 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:42:24: note: expanded from macro 'INIT_2'
> 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> | ~~~~~~~~~~^~~~
> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 129 to -127 [-Wconstant-conversion]
> 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> | ~
> 49 | [0 ... 0x1f] = -1, \
> 50 | INIT_32(0x20, ch_62, ch_63), \
> 51 | INIT_32(0x40, ch_62, ch_63), \
> 52 | INIT_32(0x60, ch_62, ch_63), \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> lib/base64.c:43:24: note: expanded from macro 'INIT_4'
> 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:42:48: note: expanded from macro 'INIT_2'
> 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> | ~~~~~~~~~~^~~~
> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Wconstant-conversion]
> 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> | ~
> 49 | [0 ... 0x1f] = -1, \
> 50 | INIT_32(0x20, ch_62, ch_63), \
> 51 | INIT_32(0x40, ch_62, ch_63), \
> 52 | INIT_32(0x60, ch_62, ch_63), \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> lib/base64.c:43:24: note: expanded from macro 'INIT_4'
> 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
I have not looked into the legitimacy of this warning yet but it comes
about from a recent change to fix -Wconstant-conversion in clang:
https://github.com/llvm/llvm-project/commit/a5ef934a8d295dc03be3960f2b3744ec2e53238e
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125
2026-09-10 22:35 ` Nathan Chancellor
@ 2026-09-11 6:41 ` Kuan-Wei Chiu
0 siblings, 0 replies; 3+ messages in thread
From: Kuan-Wei Chiu @ 2026-09-11 6:41 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, llvm, oe-kbuild-all, linux-kernel,
Andrew Morton, Linux Memory Management List, Guan-Chun Wu,
David Laight
On Thu, Sep 10, 2026 at 03:35:20PM -0700, Nathan Chancellor wrote:
> On Fri, Sep 11, 2026 at 06:07:30AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 50d05c7c76c96b90462f24debacca971d2e86713
> > commit: c4eb7ad32eab13ba64cc452c6f43d518b63f5e03 lib/base64: optimize base64_decode() with reverse lookup tables
> > date: 10 months ago
> > config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/config)
> > compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project d3db069999553568848400c84cbf815c03f5470f)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260911/202609110514.S0a0FD6a-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Fixes: c4eb7ad32eab ("lib/base64: optimize base64_decode() with reverse lookup tables")
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202609110514.S0a0FD6a-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 [-Wconstant-conversion]
> > 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> > 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> > | ~
> > 49 | [0 ... 0x1f] = -1, \
> > 50 | INIT_32(0x20, ch_62, ch_63), \
> > 51 | INIT_32(0x40, ch_62, ch_63), \
> > 52 | INIT_32(0x60, ch_62, ch_63), \
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> > 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> > 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> > lib/base64.c:43:48: note: expanded from macro 'INIT_4'
> > 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:42:48: note: expanded from macro 'INIT_2'
> > 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> > 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> > | ~~~~~~~~~~^~~~
> > lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 130 to -126 [-Wconstant-conversion]
> > 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> > 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> > | ~
> > 49 | [0 ... 0x1f] = -1, \
> > 50 | INIT_32(0x20, ch_62, ch_63), \
> > 51 | INIT_32(0x40, ch_62, ch_63), \
> > 52 | INIT_32(0x60, ch_62, ch_63), \
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> > 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> > 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> > lib/base64.c:43:48: note: expanded from macro 'INIT_4'
> > 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:42:24: note: expanded from macro 'INIT_2'
> > 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> > 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> > | ~~~~~~~~~~^~~~
> > lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 129 to -127 [-Wconstant-conversion]
> > 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> > 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> > | ~
> > 49 | [0 ... 0x1f] = -1, \
> > 50 | INIT_32(0x20, ch_62, ch_63), \
> > 51 | INIT_32(0x40, ch_62, ch_63), \
> > 52 | INIT_32(0x60, ch_62, ch_63), \
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> > 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> > 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> > lib/base64.c:43:24: note: expanded from macro 'INIT_4'
> > 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:42:48: note: expanded from macro 'INIT_2'
> > 42 | #define INIT_2(v, ...) INIT_1(v, __VA_ARGS__), INIT_1((v) + 1, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:34:42: note: expanded from macro 'INIT_1'
> > 34 | : (v) >= '0' && (v) <= '9' ? (v) - '0' + 52 \
> > | ~~~~~~~~~~^~~~
> > lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Wconstant-conversion]
> > 58 | [BASE64_IMAP] = BASE64_REV_INIT('+', ',')
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:52:2: note: expanded from macro 'BASE64_REV_INIT'
> > 48 | #define BASE64_REV_INIT(ch_62, ch_63) { \
> > | ~
> > 49 | [0 ... 0x1f] = -1, \
> > 50 | INIT_32(0x20, ch_62, ch_63), \
> > 51 | INIT_32(0x40, ch_62, ch_63), \
> > 52 | INIT_32(0x60, ch_62, ch_63), \
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:46:50: note: expanded from macro 'INIT_32'
> > 46 | #define INIT_32(v, ...) INIT_16(v, __VA_ARGS__), INIT_16((v) + 16, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > lib/base64.c:45:49: note: expanded from macro 'INIT_16'
> > 45 | #define INIT_16(v, ...) INIT_8(v, __VA_ARGS__), INIT_8((v) + 8, __VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> > lib/base64.c:43:24: note: expanded from macro 'INIT_4'
> > 43 | #define INIT_4(v, ...) INIT_2(v, __VA_ARGS__), INIT_2((v) + 2, __VA_ARGS__)
>
> I have not looked into the legitimacy of this warning yet but it comes
> about from a recent change to fix -Wconstant-conversion in clang:
>
> https://github.com/llvm/llvm-project/commit/a5ef934a8d295dc03be3960f2b3744ec2e53238e
>
This looks like a false positive rather than a real bug in the C code.
The warning triggers because (v) - '0' + 52 evaluates to >= 128 during
macro expansion which overflows s8.
However, that branch is guarded by (v) >= '0' && (v) <= '9', which is a
compile time constant false for those values, so the branch is never
taken. It seems clang is diagnosing constant conversions in
unreachable branches of compile time conditional expressions.
Regards,
Kuan-Wei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-11 6:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 22:07 lib/base64.c:58:18: warning: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 131 to -125 kernel test robot
2026-09-10 22:35 ` Nathan Chancellor
2026-09-11 6:41 ` Kuan-Wei Chiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®