public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Steven Bosscher <s.bosscher@student.tudelft.nl> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: optimization/10087: [3.3/3.4 regression] optimizer produces wrong code when indexing 2D array Date: Sat, 15 Mar 2003 00:56:00 -0000 [thread overview] Message-ID: <20030315005600.24229.qmail@sources.redhat.com> (raw) The following reply was made to PR optimization/10087; it has been noted by GNATS. From: Steven Bosscher <s.bosscher@student.tudelft.nl> To: p.van-hoof@qub.ac.uk, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Cc: Subject: Re: optimization/10087: [3.3/3.4 regression] optimizer produces wrong code when indexing 2D array Date: Sat, 15 Mar 2003 01:48:02 +0100 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10087 A little more information... A slightly smaller test case is: ---------------------------- static void b (int *i, int *j) { } int main (void) { int i, j; S x1[2][2]; S *x[2] = { x1[0], x1[1] }; S **E = x; for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) E[j][i].T1 = 1; b (&j, &i); printf ("result %.6e\n", E[1][1].T1); return 0; } ---------------------------- The line "E[j][i] =..." seems to be the problem: With j first, then i, the output is wrong (and you get a segfault as a bonus). With i first, then j ("E[i][j]=..") you get the correct result. # gcc-3.3 -O t.c # a.out result 1.000000e+00 # gcc-3.3 t.c -O -fstrength-reduce -fstrict-aliasing -fforce-mem -fgcse # a.out result 2.676500e+00 Segmentation fault Again, disable any of these four options and you get the expected output. (For the record, this is on i586-pc-linux-gnu.) Greetz Steven
next reply other threads:[~2003-03-15 0:56 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-15 0:56 Steven Bosscher [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-03-24 18:58 mmitchel 2003-03-21 19:46 Glen Nakamura 2003-03-15 0:06 Steven Bosscher 2003-03-14 23:45 bangerth
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=20030315005600.24229.qmail@sources.redhat.com \ --to=s.bosscher@student.tudelft.nl \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).