public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38297]  New: O2 causes invalid code
@ 2008-11-28  0:30 andrew at warnux dot com
  2008-11-28  0:33 ` [Bug c++/38297] " andrew at warnux dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: andrew at warnux dot com @ 2008-11-28  0:30 UTC (permalink / raw)
  To: gcc-bugs

I am compiling with g++ on a 64 bit Ubuntu OS.  I spent days trying to find out
why my programs kept crashing.  I found that when using O2 optimizations the
problem is there, when using O1 it is not a problem.

I am not using any compiler options other than stripping symbols, hiding
warnings, and O2.

Here is a very simple test case that causes the bug every time.

void RefTest(byte*& p)
{
        ++p;
}
void RefTest(char*& p)
{
        ++p;
}

char* c= "0123";
char* p= c;
RefTest((byte*&)p);
cout << p << endl; // 0123
RefTest(p);
cout << p << endl; // 123

return 0;


-- 
           Summary: O2 causes invalid code
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew at warnux dot com


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


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

end of thread, other threads:[~2008-11-30 15:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-28  0:30 [Bug c++/38297] New: O2 causes invalid code andrew at warnux dot com
2008-11-28  0:33 ` [Bug c++/38297] " andrew at warnux dot com
2008-11-28  1:39 ` pinskia at gcc dot gnu dot org
2008-11-28  2:00 ` andrew at warnux dot com
2008-11-28  2:22 ` pinskia at gcc dot gnu dot org
2008-11-28  2:35 ` andrew at warnux dot com
2008-11-28 16:40 ` andrew at warnux dot com
2008-11-28 16:54 ` pinskia at gcc dot gnu dot org
2008-11-28 19:26 ` cdfrey at netdirect dot ca
2008-11-28 22:03 ` andrew at warnux dot com
2008-11-28 22:04 ` andrew at warnux dot com
2008-11-28 23:33 ` pinskia at gcc dot gnu dot org
2008-11-28 23:37 ` cdfrey at netdirect dot ca
2008-11-30 11:44 ` rguenth at gcc dot gnu dot org
2008-11-30 15:38 ` joseph at codesourcery dot com

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