public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dhazeghi at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/56576] New: wrong code for aliased union at -O3 Date: Sat, 09 Mar 2013 01:54:00 -0000 [thread overview] Message-ID: <bug-56576-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56576 Bug #: 56576 Summary: wrong code for aliased union at -O3 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: dhazeghi@yahoo.com The following code behaves differently at -O3 than at -O2 or below on 4.7 and mainline on x86_64-linux. At -O3 it returns 1, whereas at -O2 and below it returns 0, for both -m32 and -m64 targets. It behaves as expected on gcc 4.6 at all optimization levels (returns 0). $ gcc-trunk --version gcc-trunk (GCC) 4.8.0 20130308 (experimental) [trunk revision 196555] $ gcc-trunk -O2 trans-reduced.c $ ./a.out $ echo $? 0 $ gcc-trunk -O3 trans-reduced.c $ ./a.out $ echo $? 1 $ gcc-4.6 -O3 trans-reduced.c $ ./a.out $ echo $? 0 $ cat trans-reduced.c /* gcc-4.7/gcc-trunk -O3 -m32/-m64 */ union { int f0; int f1; long f2; } a, b; int c, h; int *d, *e = &a.f0; long *f = &b.f2; int **g = &d; void fn1 () { c = 0; for (; c <= 3; c++) { int *i = &b.f1; *f = 1; *i = 0; *g = 0; h = *e; } } int main () { fn1 (); return b.f0; }
next reply other threads:[~2013-03-09 1:54 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-09 1:54 dhazeghi at yahoo dot com [this message] 2013-03-09 8:26 ` [Bug tree-optimization/56576] " jakub at gcc dot gnu.org 2013-03-10 21:17 ` pinskia at gcc dot gnu.org 2024-06-02 16:10 ` pinskia at gcc dot gnu.org 2024-06-02 16:11 ` pinskia at gcc dot gnu.org 2024-06-02 16:12 ` pinskia 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-56576-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).