https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104115

            Bug ID: 104115
           Summary: Does not understand that inequality is transitive
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thvdveld at vub dot be
  Target Milestone: ---

GCC seems to fail to eliminate the third assert for unsigned integers.
This works as expected when integers are used instead of unsigned.

```c
void f(unsigned int a, unsigned int b, unsigned int c) {
    assert(a < b);
    assert(b < c);
    assert(a < c);
}
```

https://gcc.godbolt.org/z/o9ajsMTb7

LLVM seems to be able to optimize the unsigned version, however not the version
with `int`. (https://github.com/llvm/llvm-project/issues/53273)

Reply via email to