public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dpb at corrigendum dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/60196] New: Incorrect compilation with -fwrapv and -ftree-vectorize Date: Fri, 14 Feb 2014 15:22:00 -0000 [thread overview] Message-ID: <bug-60196-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60196 Bug ID: 60196 Summary: Incorrect compilation with -fwrapv and -ftree-vectorize Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dpb at corrigendum dot ru Created attachment 32135 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32135&action=edit Preprocessed source for the reproducer This program should print 36 (preprocessed source attached): #include <stdio.h> static int foo(const short * a, int len) { int x; int x1 = 0; for( x = 0; x < len; x++ ) x1 += x * a[x]; return x1; } int main() { short stuff[9] = {1,1,1,1,1,1,1,1,1}; printf("%d\n", foo(stuff, 9)); return 0; } However, if compiled with -O1 -fwrapv -ftree-vectorize, it prints 16 instead. Omitting any of those flags gives the correct result. I can reproduce this on 4.8.2 and 4.8 branch head. It doesn't reproduce on trunk, though. (All three built from vanilla source.) Target is x86_64-unknown-linux-gnu. I also tested it on a bunch of Ubuntu's prebuilt GCC versions. It reproduces on 4.6.4, 4.7.3, 4.8.1, but not on 4.4.7.
next reply other threads:[~2014-02-14 15:22 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-14 15:22 dpb at corrigendum dot ru [this message] 2014-03-12 14:33 ` [Bug tree-optimization/60196] " dpb at corrigendum dot ru 2014-03-12 16:08 ` [Bug tree-optimization/60196] [4.8 Regression] " jakub at gcc dot gnu.org 2014-05-22 9:02 ` rguenth at gcc dot gnu.org 2014-09-08 20:08 ` jakub at gcc dot gnu.org 2014-09-08 20:16 ` jakub at gcc dot gnu.org 2014-09-08 20:18 ` jakub at gcc dot gnu.org 2014-09-08 20:18 ` jakub 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-60196-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).