Re: s390: block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_557' declared with 'error' attribute: clamp() low limit 1 greater than high limit active

From: Dan Carpenter
Date: Wed Dec 04 2024 - 09:39:43 EST


Let's add David to the Cc list because he's the expert on clamp().

regards,
dan carpenter

On Wed, Dec 04, 2024 at 04:01:09PM +0530, Naresh Kamboju wrote:
> The s390 builds failed with clang-19 with defconfig on the
> Linux next-20241203 tag due to following build warnings / errors.
> Build pass with gcc-13 defconfig for s390.
>
> First seen on Linux next-20241203 tag
> GOOD: Linux next-20241128 tag
> BAD: Linux next-20241203 tag
>
> List of arch and toolchains :
> s390 defconfig with clang-19
>
> s390:
> build:
> * clang-19-defconfig
> * korg-clang-19-lkftconfig-lto-full
> * korg-clang-19-lkftconfig-hardening
> * korg-clang-19-lkftconfig-lto-thing
>
> Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Build log:
> ===========
> block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_557'
> declared with 'error' attribute: clamp() low limit 1 greater than high
> limit active
> 1101 | inuse = clamp_t(u32, inuse, 1, active);
> | ^
> include/linux/minmax.h:218:36: note: expanded from macro 'clamp_t'
> 218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
> | ^
> include/linux/minmax.h:195:2: note: expanded from macro '__careful_clamp'
> 195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_),
> __UNIQUE_ID(l_), __UNIQUE_ID(h_))
> | ^
> include/linux/minmax.h:188:2: note: expanded from macro '__clamp_once'
> 188 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi),
> \
> | ^
> note: (skipping 2 expansions in backtrace; use
> -fmacro-backtrace-limit=0 to see all)
> include/linux/compiler_types.h:530:2: note: expanded from macro
> '_compiletime_assert'
> 530 | __compiletime_assert(condition, msg, prefix, suffix)
> | ^
> include/linux/compiler_types.h:523:4: note: expanded from macro
> '__compiletime_assert'
> 523 | prefix ## suffix();
> \
> | ^
> <scratch space>:38:1: note: expanded from here
> 38 | __compiletime_assert_557
> | ^
> block/blk-iocost.c:1101:11: error: call to '__compiletime_assert_557'
> declared with 'error' attribute: clamp() low limit 1 greater than high
> limit active
> include/linux/minmax.h:218:36: note: expanded from macro 'clamp_t'
> 218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
> | ^
> include/linux/minmax.h:195:2: note: expanded from macro '__careful_clamp'
> 195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_),
> __UNIQUE_ID(l_), __UNIQUE_ID(h_))
> | ^
> include/linux/minmax.h:188:2: note: expanded from macro '__clamp_once'
> 188 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi),
> \
> | ^
> note: (skipping 2 expansions in backtrace; use
> -fmacro-backtrace-limit=0 to see all)
> include/linux/compiler_types.h:530:2: note: expanded from macro
> '_compiletime_assert'
> 530 | __compiletime_assert(condition, msg, prefix, suffix)
> | ^
> include/linux/compiler_types.h:523:4: note: expanded from macro
> '__compiletime_assert'
> 523 | prefix ## suffix();
> \
> | ^
> <scratch space>:38:1: note: expanded from here
> 38 | __compiletime_assert_557
> | ^
> 2 errors generated.
>
> Links:
> ---
> - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26188938/suite/build/test/clang-19-defconfig/log
> - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26188938/suite/build/test/clang-19-defconfig/history/
> - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241203/testrun/26188938/suite/build/test/clang-19-defconfig/details/
>
> Steps to reproduce:
> ------------
> # tuxmake --runtime podman --target-arch s390 --toolchain clang-19
> --kconfig defconfig LLVM_IAS=1
>
> metadata:
> ----
> git describe: next-20241203
> git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> git sha: c245a7a79602ccbee780c004c1e4abcda66aec32
> kernel config:
> https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAPS9UrJkbAKFHktQei7eqW4Y/config
> build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2pjAPS9UrJkbAKFHktQei7eqW4Y/
> toolchain: clang-19
> config: clang-19-defconfig
> arch: s390
>
> --
> Linaro LKFT
> https://lkft.linaro.org