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

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).