[PATCH] D76096: [clang] allow const structs/unions/arrays to be constant expressions for C
David Spickett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 7 01:38:07 PDT 2023
DavidSpickett added a comment.
One of the kernel tests now fails to build for AArch64 and Arm:
00:00:48 ++ make CC=/home/tcwg-buildslave/workspace/tcwg_kernel_0/bin/aarch64-cc LD=/home/tcwg-buildslave/workspace/tcwg_kernel_0/llvm-install/bin/ld.lld SUBLEVEL=0 EXTRAVERSION=-bisect ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=/home/tcwg-buildslave/workspace/tcwg_kernel_0/llvm-install/bin/clang -j32 -s -k
00:08:26 lib/test_scanf.c:661:2: error: implicit conversion from 'int' to 'unsigned char' changes value from -168 to 88 [-Werror,-Wconstant-conversion]
00:08:26 661 | test_number_prefix(unsigned char, "0xA7", "%2hhx%hhx", 0, 0xa7, 2, check_uchar);
00:08:26 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00:08:26 lib/test_scanf.c:609:29: note: expanded from macro 'test_number_prefix'
00:08:26 609 | T result[2] = {~expect[0], ~expect[1]}; \
00:08:26 | ~ ^~~~~~~~~~
00:08:27 1 error generated.
00:08:27 make[3]: *** [scripts/Makefile.build:243: lib/test_scanf.o] Error 1
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/test_scanf.c#n661
Seems like the test should be fixed, though I wonder why this same error isn't effecting GCC builds.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76096/new/
https://reviews.llvm.org/D76096
More information about the cfe-commits
mailing list