Skip to content

OjectFLED: dead '>= 0' guards on unsigned variables (OjectFLED.cpp.hpp:676,690) — latent logic bug #2726

Closed

Description

@zackees

Summary

-Wtype-limits "comparison of unsigned expression in >= 0 is always true" in vendored OjectFLED driver:

src/third_party/object_fled/src/OjectFLED.cpp.hpp:676:45
src/third_party/object_fled/src/OjectFLED.cpp.hpp:690:45

Fires on every Teensy 4.x build (teensy40, teensy41, teensy_octoWS2811).

Why it is not noise

The guard is dead code — it never excludes any value. Either:

  • The variable was originally int/int32_t and someone migrated to unsigned without removing the >= 0 check, OR
  • The author meant to write <= MAX and typoed.

Either way it is a latent logic bug indicator. Worth a 5-minute review.

Proposed fix

Read both call sites at 676 and 690; drop the >= 0 clause (if the signed->unsigned migration was intentional) or fix the bound to whatever was meant. Since this is vendored upstream code (third_party/object_fled/), consider also reporting/PRing the fix upstream and pulling it back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions