public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "djg at cray dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/29145] New: unsafe use of restrict qualifier Date: Tue, 19 Sep 2006 15:55:00 -0000 [thread overview] Message-ID: <bug-29145-12972@http.gcc.gnu.org/bugzilla/> (raw) In the test case below, GCC doesn't observe a non-restrict-qualified pointer being "based on" a restrict-qualified pointer. On i686-pc-linux-gnu, this program aborts when compiled with -O2 -msse -ftree-vectorize because the loop in function with_restrict is vectorized based on an unsafe alias assumption. void abort(void); void exit(int); void with_restrict(int * __restrict p) { int i; int *q = p - 2; for (i = 0; i < 1000; ++i) { p[i] = q[i]; } } void without_restrict(int * p) { int i; int *q = p - 2; for (i = 0; i < 1000; ++i) { p[i] = q[i]; } } int main(void) { int i; int a[1002]; int b[1002]; for (i = 0; i < 1002; ++i) { a[i] = b[i] = i; } with_restrict(a + 2); without_restrict(b + 2); for (i = 0; i < 1002; ++i) { if (a[i] != b[i]) abort(); } exit(0); } -- Summary: unsafe use of restrict qualifier Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: djg at cray dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29145
next reply other threads:[~2006-09-19 15:55 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-09-19 15:55 djg at cray dot com [this message] 2006-09-19 16:43 ` [Bug tree-optimization/29145] " pinskia at gcc dot gnu dot org 2006-09-20 23:49 ` djg at cray dot com 2006-11-02 16:07 ` ian at airs dot com 2006-11-02 16:10 ` rguenth at gcc dot gnu dot org 2006-11-04 4:15 ` dberlin at gcc dot gnu dot org 2006-11-05 15:48 ` dorit at il dot ibm dot com 2006-11-05 16:50 ` djg at cray dot com 2007-01-07 20:22 ` dorit at il dot ibm dot com 2007-01-09 9:35 ` patchapp at dberlin dot org 2007-01-26 21:09 ` djg at cray dot com 2007-02-06 8:18 ` dorit at il dot ibm dot com 2007-02-12 13:15 ` dorit at gcc dot gnu dot org 2007-07-01 8:32 ` dorit at gcc dot gnu dot 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-29145-12972@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).