public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "abenea at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/49873] New: Optimizer regression Date: Wed, 27 Jul 2011 16:58:00 -0000 [thread overview] Message-ID: <bug-49873-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49873 Summary: Optimizer regression Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: abenea@gmail.com Test code: typedef struct { char *ptr; } S; void f1(char* data) { S s; s.ptr = 0; char *same_data = s.ptr + (data - s.ptr); same_data[0] = 1; } int main() { char c; f1(&c); if (c != 1) return 1; return 0; } Compiled with gcc version 4.4.6, the program above returns 0 regardless of the optimization level. Compiled with gcc versions 4.5.3 or 4.6.1, the return value is 0 only with -O0. Using -O1, -O2, -O3 or -Os, the return value is 1. The correct value (0) is returned if s.ptr is replaced with a local variable or the code from the function f1 is moved inside main.
next reply other threads:[~2011-07-27 16:58 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-27 16:58 abenea at gmail dot com [this message] 2011-07-27 17:00 ` [Bug tree-optimization/49873] " pinskia at gcc dot gnu.org 2011-07-28 9:56 ` rguenth at gcc dot gnu.org
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-49873-4@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).