public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "stevenj at alum dot mit.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54498] New: incorrect code generation from g++ -O on x86_64 Date: Wed, 05 Sep 2012 21:50:00 -0000 [thread overview] Message-ID: <bug-54498-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54498 Bug #: 54498 Summary: incorrect code generation from g++ -O on x86_64 Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: stevenj@alum.mit.edu Created attachment 28136 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28136 preprocessed source exhibiting the problem The attached preprocessed source (bug.ii) illustrates an apparent incorrect code generation when it is compiled with g++ -O version 4.7.1 on x86_64 (Debian GNU/Linux). The program executes two iterations of a loop, calling a function that returns two slightly different complex numbers in the two iterations. After the second iteration, it prints the absolute value of the difference. The correct output (when compiled without optimization) is: ft (it = 0) = -491.697+887.05i ft (it = 1) = -491.692+887.026i abs(ft - prev_ft) = 0.0245153 (0.0245153 is the correct absolute difference of the two previous numbers.) When compiled with -O, it produces: ft (it = 0) = -491.697+887.05i ft (it = 1) = -491.692+887.026i abs(ft - prev_ft) = 491.692 Note that the first two numbers are the same, but the absolute value of the difference is wrong. The problem disappears if I use g++ 4.4.5, or if I make minor changes to the code; I've tried to boil it down to the minimal code that exhibits the problem. Steven PS. The preprocessed source is rather long only because it #includes <stdio.h> and <complex>; the program source at the end is quite short. PPS. Some of my g++ -v output follows, indicating the g++ configuration options etcetera: Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/home/stevenj/downloads/gcc/gcc-4.7.1/OBJ/../local --disable-multilib --enable-languages=c,c++ GNU C++ (GCC) version 4.7.1 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
next reply other threads:[~2012-09-05 21:50 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-05 21:50 stevenj at alum dot mit.edu [this message] 2012-09-05 22:22 ` [Bug tree-optimization/54498] [4.7/4.8 Regression] incorrect code generation from g++ -O pinskia at gcc dot gnu.org 2012-09-06 9:58 ` rguenth at gcc dot gnu.org 2012-09-06 10:21 ` rguenth at gcc dot gnu.org 2012-09-06 12:22 ` hjl.tools at gmail dot com 2012-09-06 13:54 ` [Bug tree-optimization/54498] [4.6/4.7/4.8 " rguenth at gcc dot gnu.org 2012-09-06 14:48 ` rguenth at gcc dot gnu.org 2012-09-06 15:20 ` rguenth at gcc dot gnu.org 2012-09-07 8:20 ` [Bug tree-optimization/54498] [4.6 " rguenth at gcc dot gnu.org 2013-04-12 16:30 ` jakub at gcc dot gnu.org 2023-03-27 12:32 ` cvs-commit 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-54498-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).