public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "argondsgn at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47670] New: Gcc 4.5.1 inconsistent optimisation of loop with mixed 32bit and 64bit arithmetic Date: Wed, 09 Feb 2011 20:56:00 -0000 [thread overview] Message-ID: <bug-47670-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47670 Summary: Gcc 4.5.1 inconsistent optimisation of loop with mixed 32bit and 64bit arithmetic Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: argondsgn@gmail.com Created attachment 23290 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23290 Output of gcc -v save-temps -O2 bug.c int main(int argc, char *argv[]) { int i; long long count=0; int ret; for (i=0;i<9;i++) { count+=i*0x40000000; } ret=count>>32; return ret; } produces different answers when compiled with gcc -O1 bug.c (returns -1) or gcc -O2 bug.c (returns 9) Judging from the assembler output with -S, this loop is optimised to a different constant expression in the two cases. It works with gcc 3.4.4, but not with gcc 4.5.1 (I haven't tested any other versions yet) (First time I've attempted to submit a bug report to an open source project, so many apologies if this is already fixed, an issue with my understanding of C, or in the wrong category!)
next reply other threads:[~2011-02-09 20:55 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-09 20:56 argondsgn at gmail dot com [this message] 2011-02-09 21:14 ` [Bug c/47670] " rguenth at gcc dot gnu.org 2011-02-09 21:20 ` rguenth at gcc dot gnu.org 2011-02-09 21:54 ` jakub at gcc dot gnu.org 2011-02-09 22:00 ` argondsgn at gmail 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-47670-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).