public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
@ 2021-04-28 12:52 peshkoff at mail dot ru
  2021-04-28 13:50 ` [Bug rtl-optimization/100317] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: peshkoff at mail dot ru @ 2021-04-28 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100317
           Summary: 64-bit integer compare gives wrong result when
                    MIN_INT64 is one of the operands
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peshkoff at mail dot ru
  Target Milestone: ---

Created attachment 50701
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50701&action=edit
Test demonstrating comparison bug

A problem happens in trivial function comparing absolute values of 64-bit
integers. If first operand is minimum int64 value (it's absolute value is
bigger than any 64-bit number) function returns wrong value (-1) when compiled
with -O2 or higher. 

Attached example demonstrates that bug - compile it with or without -O2 and get
different results. That behavior can be "fixed" using hack under #ifdef
COMPARE_BUG_FIX, but correct comparison result is desired. I've set version in
the tracker to 9.3 - this is last version I've used to check, but versions 6.4,
6.5 and 8.3 are also affected.

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

* [Bug rtl-optimization/100317] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
@ 2021-04-28 13:50 ` rguenth at gcc dot gnu.org
  2021-04-28 13:58 ` peshkoff at mail dot ru
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-28 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0, 9.3.1
      Known to fail|                            |8.4.1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-28
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Works with GCC 10 and on the top of the GCC 9 branch so probably a duplicate.

Confirmed on the GCC 8 branch.

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

* [Bug rtl-optimization/100317] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
  2021-04-28 13:50 ` [Bug rtl-optimization/100317] " rguenth at gcc dot gnu.org
@ 2021-04-28 13:58 ` peshkoff at mail dot ru
  2021-04-28 14:23 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: peshkoff at mail dot ru @ 2021-04-28 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Peshkoff <peshkoff at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.2.0

--- Comment #2 from Alex Peshkoff <peshkoff at mail dot ru> ---
Checked on 10.2.0 and confirm - it works. I've searched for it on the tracker
but could not find duplicate.

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

* [Bug rtl-optimization/100317] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
  2021-04-28 13:50 ` [Bug rtl-optimization/100317] " rguenth at gcc dot gnu.org
  2021-04-28 13:58 ` peshkoff at mail dot ru
@ 2021-04-28 14:23 ` jakub at gcc dot gnu.org
  2021-04-28 14:24 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-28 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
PR95810 ?

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

* [Bug rtl-optimization/100317] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
                   ` (2 preceding siblings ...)
  2021-04-28 14:23 ` jakub at gcc dot gnu.org
@ 2021-04-28 14:24 ` jakub at gcc dot gnu.org
  2021-04-28 17:57 ` [Bug rtl-optimization/100317] [8 only] " pinskia at gcc dot gnu.org
  2021-05-14 14:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-28 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
An the reason it hasn't been backported to 8 branch is that ABSU_EXPR doesn't
exist there.

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

* [Bug rtl-optimization/100317] [8 only] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
                   ` (3 preceding siblings ...)
  2021-04-28 14:24 ` jakub at gcc dot gnu.org
@ 2021-04-28 17:57 ` pinskia at gcc dot gnu.org
  2021-05-14 14:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-28 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5

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

* [Bug rtl-optimization/100317] [8 only] 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands
  2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
                   ` (4 preceding siblings ...)
  2021-04-28 17:57 ` [Bug rtl-optimization/100317] [8 only] " pinskia at gcc dot gnu.org
@ 2021-05-14 14:05 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|8.5                         |9.4

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The GCC 8 branch is being closed, fixed in GCC 9.4.

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

end of thread, other threads:[~2021-05-14 14:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 12:52 [Bug rtl-optimization/100317] New: 64-bit integer compare gives wrong result when MIN_INT64 is one of the operands peshkoff at mail dot ru
2021-04-28 13:50 ` [Bug rtl-optimization/100317] " rguenth at gcc dot gnu.org
2021-04-28 13:58 ` peshkoff at mail dot ru
2021-04-28 14:23 ` jakub at gcc dot gnu.org
2021-04-28 14:24 ` jakub at gcc dot gnu.org
2021-04-28 17:57 ` [Bug rtl-optimization/100317] [8 only] " pinskia at gcc dot gnu.org
2021-05-14 14:05 ` jakub 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).