public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65307] New: Incorrect optimization breaks basic arithmetic
@ 2015-03-04  8:18 madars+gccbug at gmail dot com
  2015-03-04  8:33 ` [Bug c/65307] " madars+gccbug at gmail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: madars+gccbug at gmail dot com @ 2015-03-04  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65307
           Summary: Incorrect optimization breaks basic arithmetic
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: madars+gccbug at gmail dot com

The following code sample exhibits a bug in a gcc -O2 optimization pass.
Namely, having defined two() and six() with the obvious return values, the
value of two() * 2 + six() * 5 gets an assembly of 1 shl 5 (i.e. 32, instead of
the correct 34).

Code: http://web.mit.edu/madars/Public/gcc-basic-arithmetic-bug.c

gcc 4.9.1 and 4.9.2 with -O2 are both buggy, -O1 makes the bug go away; the bug
does not seem to be present in gcc 4.8 and earlier.


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

end of thread, other threads:[~2015-06-26 20:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  8:18 [Bug c/65307] New: Incorrect optimization breaks basic arithmetic madars+gccbug at gmail dot com
2015-03-04  8:33 ` [Bug c/65307] " madars+gccbug at gmail dot com
2015-03-04  9:20 ` andersk at mit dot edu
2015-03-04 10:20 ` [Bug tree-optimization/65307] [4.9 Regression] " mpolacek at gcc dot gnu.org
2015-03-04 12:30 ` ktietz at gcc dot gnu.org
2015-03-04 12:51 ` mpolacek at gcc dot gnu.org
2015-03-04 12:52 ` manu at gcc dot gnu.org
2015-03-04 13:06 ` ktietz at gcc dot gnu.org
2015-03-04 13:34 ` rguenth at gcc dot gnu.org
2015-03-04 13:44 ` maltsevm at gmail dot com
2015-03-04 14:21 ` rguenth at gcc dot gnu.org
2015-03-04 14:44 ` [Bug tree-optimization/65307] [4.9/5 " rguenth at gcc dot gnu.org
2015-03-04 14:56 ` rguenth at gcc dot gnu.org
2015-03-05  1:30 ` [Bug tree-optimization/65307] [4.9 " madars+gccbug at gmail dot com
2015-06-26 19:59 ` jakub at gcc dot gnu.org
2015-06-26 20:30 ` 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).