public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104115] New: Does not understand that inequality is transitive
@ 2022-01-19 13:00 thvdveld at vub dot be
  2022-01-19 13:13 ` [Bug c/104115] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: thvdveld at vub dot be @ 2022-01-19 13:00 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/104115] Does not understand that inequality is transitive
  2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
@ 2022-01-19 13:13 ` rguenth at gcc dot gnu.org
  2022-01-19 13:16 ` thvdveld at vub dot be
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-19 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12 handles this fine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/104115] Does not understand that inequality is transitive
  2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
  2022-01-19 13:13 ` [Bug c/104115] " rguenth at gcc dot gnu.org
@ 2022-01-19 13:16 ` thvdveld at vub dot be
  2022-01-19 13:30 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: thvdveld at vub dot be @ 2022-01-19 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Thibaut Vandervelden <thvdveld at vub dot be> ---
Sorry, my bad.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/104115] Does not understand that inequality is transitive
  2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
  2022-01-19 13:13 ` [Bug c/104115] " rguenth at gcc dot gnu.org
  2022-01-19 13:16 ` thvdveld at vub dot be
@ 2022-01-19 13:30 ` jakub at gcc dot gnu.org
  2022-01-19 13:31 ` jakub at gcc dot gnu.org
  2022-01-19 14:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Since r12-3119-g675a3e40567e1d0dd6d7e7be3efab74b22731415
Maybe we want the testcase for the testsuite so that we don't regress it?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/104115] Does not understand that inequality is transitive
  2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
                   ` (2 preceding siblings ...)
  2022-01-19 13:30 ` jakub at gcc dot gnu.org
@ 2022-01-19 13:31 ` jakub at gcc dot gnu.org
  2022-01-19 14:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, gcc.dg/tree-ssa/evrp-trans.c seems to cover it for int, but perhaps it
would be useful to have a variant of the testcase with unsigned types instead
of signed too.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/104115] Does not understand that inequality is transitive
  2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
                   ` (3 preceding siblings ...)
  2022-01-19 13:31 ` jakub at gcc dot gnu.org
@ 2022-01-19 14:03 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-19 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:f35bb467a01db988d5fe1637db5bff4b4f9e7086

commit r12-6738-gf35bb467a01db988d5fe1637db5bff4b4f9e7086
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 19 15:02:31 2022 +0100

    testsuite: Test evrp-trans.c also with unsigned types [PR104115]

    The testcase from the PR got fixed with r12-3119-g675a3e40567e1d
    and looks quite similar to the evrp-trans.c test, except evrp-trans.c
    is tested on signed integer types.
    I think it would be useful to test it for unsigned comparisons too.

    2022-01-19  Jakub Jelinek  <jakub@redhat.com>

            PR c/104115
            * gcc.dg/tree-ssa/evrp-trans2.c: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-19 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 13:00 [Bug c/104115] New: Does not understand that inequality is transitive thvdveld at vub dot be
2022-01-19 13:13 ` [Bug c/104115] " rguenth at gcc dot gnu.org
2022-01-19 13:16 ` thvdveld at vub dot be
2022-01-19 13:30 ` jakub at gcc dot gnu.org
2022-01-19 13:31 ` jakub at gcc dot gnu.org
2022-01-19 14:03 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).