Skip to content

Build Failure in flash_image.c Due to Comparison Always Evaluating to True #1061

Description

@cwozny

There appears to be a build failure when compiling the flash image utility in both the master branch and tagged release 2025.10:

[ 67%] Building C object host/utilities/bladeRF-cli/CMakeFiles/bladeRF-cli.dir/src/cmd/flash_image.c.o
~/bladeRF/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
71 | if (val[i] >= 'a' || val[i] <= 'f') {
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [host/utilities/bladeRF-cli/CMakeFiles/bladeRF-cli.dir/src/cmd/flash_image.c.o] Error 1
make[1]: *** [host/utilities/bladeRF-cli/CMakeFiles/bladeRF-cli.dir/all] Error 2
make: *** [all] Error 2

This is with clang v21:

% gcc -v
Apple clang version 21.0.0 (clang-2100.0.123.102)
Target: arm64-apple-darwin25.4.0

It looks like that block of code is attempting to capitalize lowercase letters, so I suspect the conditional should be:

if ('a' <= val[i] && val[i] <= 'f')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions