public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator?
@ 2011-05-24 17:21 doko at ubuntu dot com
  2011-05-24 17:45 ` [Bug tree-optimization/49144] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: doko at ubuntu dot com @ 2011-05-24 17:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

           Summary: [4.6/4.7 regression] miscompiled reverse_iterator?
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: doko@ubuntu.com


[forwarded from http://bugs.debian.org/PR627795]

seen with 4.6 r174102 and trunk r173903

The attached test program is supposed to print -42, and does so when compiled
with g++-4.4 or g++-4.5. However, it outputs random junk when compiled with
g++-4.6:

$ g++ -Wall -O2 test.cxx
$ ./a.out
31
$ ./a.out
207
$ ./a.out
79


#include <iostream>

int f()
{
    unsigned char data[3] = { 42, 42, 42 };
    unsigned char *begin = data;
    unsigned char *end = data + 3;
    std::reverse_iterator<unsigned char *> reversed(end);
    for (; begin < end; begin++, reversed++)
        if (*reversed != 42)
            return *reversed;
    return -42;
}

int main(int argc, char ** argv)
{
    std::cout << f() << "\n";
}


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

* [Bug tree-optimization/49144] [4.6/4.7 regression] miscompiled reverse_iterator?
  2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
@ 2011-05-24 17:45 ` paolo.carlini at oracle dot com
  2011-05-24 23:27 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-24 17:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.24 17:30:16
                 CC|                            |rguenth at gcc dot gnu.org
          Component|other                       |tree-optimization
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-24 17:30:16 UTC ---
Seems indeed a serious issue, note happen only at -O1 and above. Let's ask
Richard to have a look.


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

* [Bug tree-optimization/49144] [4.6/4.7 regression] miscompiled reverse_iterator?
  2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
  2011-05-24 17:45 ` [Bug tree-optimization/49144] " paolo.carlini at oracle dot com
@ 2011-05-24 23:27 ` jakub at gcc dot gnu.org
  2011-05-25  3:35 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-24 23:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-24 21:58:09 UTC ---
Seems tree dse2 removes data[0] = 42; store.


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

* [Bug tree-optimization/49144] [4.6/4.7 regression] miscompiled reverse_iterator?
  2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
  2011-05-24 17:45 ` [Bug tree-optimization/49144] " paolo.carlini at oracle dot com
  2011-05-24 23:27 ` jakub at gcc dot gnu.org
@ 2011-05-25  3:35 ` hjl.tools at gmail dot com
  2011-05-25  8:58 ` rguenth at gcc dot gnu.org
  2011-05-25 11:29 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-05-25  3:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidxl at gcc dot gnu.org
   Target Milestone|---                         |4.6.1

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-05-25 02:32:27 UTC ---
It is caused by revision 162587:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00941.html


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

* [Bug tree-optimization/49144] [4.6/4.7 regression] miscompiled reverse_iterator?
  2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
                   ` (2 preceding siblings ...)
  2011-05-25  3:35 ` hjl.tools at gmail dot com
@ 2011-05-25  8:58 ` rguenth at gcc dot gnu.org
  2011-05-25 11:29 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-25  8:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |48702

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-25 08:30:28 UTC ---
Sounds similar to PR48702.


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

* [Bug tree-optimization/49144] [4.6/4.7 regression] miscompiled reverse_iterator?
  2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
                   ` (3 preceding siblings ...)
  2011-05-25  8:58 ` rguenth at gcc dot gnu.org
@ 2011-05-25 11:29 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-25 11:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49144

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Depends on|48702                       |
         Resolution|                            |DUPLICATE

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-25 10:33:24 UTC ---
I have verified that the patches for PR48702 also fix this bug.

*** This bug has been marked as a duplicate of bug 48702 ***


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

end of thread, other threads:[~2011-05-25 11:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 17:21 [Bug other/49144] New: [4.6/4.7 regression] miscompiled reverse_iterator? doko at ubuntu dot com
2011-05-24 17:45 ` [Bug tree-optimization/49144] " paolo.carlini at oracle dot com
2011-05-24 23:27 ` jakub at gcc dot gnu.org
2011-05-25  3:35 ` hjl.tools at gmail dot com
2011-05-25  8:58 ` rguenth at gcc dot gnu.org
2011-05-25 11:29 ` rguenth 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).