Skip to content

clang-analyzer-core.UndefinedBinaryOperatorResult false-postive #112527

Open
@nick-potenski

Description

@nick-potenski

The clang-analyzer-core.UndefinedBinaryOperatorResult incorrectly assumes an std::array's size() function can return 0 when used as the condition in a for loop with an index even though the array's size is a compile-time constant. This causes the analysis to skip the loop's body and leads to a false-positive uninitialized variable. I have a simplified reproduction case in Compiler Explorer here: https://godbolt.org/z/jGb3dv1qP

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions