public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andrew at warnux dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/38297] New: O2 causes invalid code Date: Fri, 28 Nov 2008 00:30:00 -0000 [thread overview] Message-ID: <bug-38297-17012@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2008-11-28 0:30 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-11-28 0:30 andrew at warnux dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-38297-17012@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).