public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/33714] New: ivopts miscompiles insn-output.c @ 2007-10-09 15:52 matz at gcc dot gnu dot org 2007-10-09 15:52 ` [Bug middle-end/33714] " matz at gcc dot gnu dot org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: matz at gcc dot gnu dot org @ 2007-10-09 15:52 UTC (permalink / raw) To: gcc-bugs This was noticed by building a cross compiler from i386 to x86_64. gcc 4.2.1 will miscompile insn-output.c, the prologue_save_insn emitter. Can be extracted to the attached runtime testcase. The loop exit condition is miscompiled by ivopts with simply -O2. Before ivopts we have: i_28 = i_48 - 1; D.1652_15 = (long long int) i_28; D.1654_18 = *D.1653_45; D.1655_19 = D.1654_18->u.hwint[0]; if (D.1652_15 >= D.1655_19) goto <L19>; else goto <L11>; i.e. it compares with i_48-1, which is the loop iterator. ivopts transforms this into: i_28 = i_48 - 1; D.1858_83 = i_4 - 1; D.1859_84 = (long long unsigned int) D.1858_83; D.1860_85 = ivtmp.163_71 * 16; D.1861_86 = D.1859_84 + D.1860_85; D.1652_87 = (long long int) D.1861_86; D.1652_15 = D.1652_87; D.1654_18 = *D.1653_45; D.1655_19 = D.1654_18->u.hwint[0]; ivtmp.163_72 = ivtmp.163_71 - 16; if (D.1652_15 >= D.1655_19) goto <L19>; else goto <L11>; i_4-1 is the base variable for the loop iterator. ivopts tries to express the D.1652_15 in terms of that base and the new ivtmp.163. Unfortunately that ivtmp is multiplied by 16, and also has a stepsize of 16 (the multiplication by 16 actually is wrong even if the stepsize would be 16 as that then would multiply by 256 for the use in the D.1860_85 expression). -- Summary: ivopts miscompiles insn-output.c Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: matz at gcc dot gnu dot org GCC host triplet: i686-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org @ 2007-10-09 15:52 ` matz at gcc dot gnu dot org 2007-10-09 16:16 ` [Bug middle-end/33714] [4.2 Regression] " rguenth at gcc dot gnu dot org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: matz at gcc dot gnu dot org @ 2007-10-09 15:52 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from matz at gcc dot gnu dot org 2007-10-09 15:52 ------- Created an attachment (id=14331) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14331&action=view) runtime testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] [4.2 Regression] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org 2007-10-09 15:52 ` [Bug middle-end/33714] " matz at gcc dot gnu dot org @ 2007-10-09 16:16 ` rguenth at gcc dot gnu dot org 2007-10-09 16:51 ` rakdver at gcc dot gnu dot org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: rguenth at gcc dot gnu dot org @ 2007-10-09 16:16 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from rguenth at gcc dot gnu dot org 2007-10-09 16:16 ------- Confirmed. You need HWI of 32bits to trigger the problem. Maybe latent on the trunk (I didn't check if it fails there, too). -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org, rakdver at gcc dot gnu | |dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC target triplet| |i?86-*-* Keywords| |wrong-code Known to fail| |4.2.2 Known to work| |4.1.1 Last reconfirmed|0000-00-00 00:00:00 |2007-10-09 16:16:38 date| | Summary|ivopts miscompiles insn- |[4.2 Regression] ivopts |output.c |miscompiles insn-output.c http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] [4.2 Regression] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org 2007-10-09 15:52 ` [Bug middle-end/33714] " matz at gcc dot gnu dot org 2007-10-09 16:16 ` [Bug middle-end/33714] [4.2 Regression] " rguenth at gcc dot gnu dot org @ 2007-10-09 16:51 ` rakdver at gcc dot gnu dot org 2007-10-12 3:03 ` rakdver at gcc dot gnu dot org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: rakdver at gcc dot gnu dot org @ 2007-10-09 16:51 UTC (permalink / raw) To: gcc-bugs -- rakdver at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rakdver at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2007-10-09 16:16:38 |2007-10-09 16:51:25 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] [4.2 Regression] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org ` (2 preceding siblings ...) 2007-10-09 16:51 ` rakdver at gcc dot gnu dot org @ 2007-10-12 3:03 ` rakdver at gcc dot gnu dot org 2007-10-12 22:27 ` rakdver at gcc dot gnu dot org 2007-10-22 8:38 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: rakdver at gcc dot gnu dot org @ 2007-10-12 3:03 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from rakdver at gcc dot gnu dot org 2007-10-12 03:03 ------- (In reply to comment #2) > Confirmed. You need HWI of 32bits to trigger the problem. Maybe latent on > the trunk (I didn't check if it fails there, too). The problem was fixed in mainline in this commit (I somehow did not realize that this code was present also in 4.2): 2006-12-13 Zdenek Dvorak <dvorakz@suse.cz> * tree-ssa-loop-ivopts.c: ... (constant_multiple_of): Fix order of operators for division. ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] [4.2 Regression] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org ` (3 preceding siblings ...) 2007-10-12 3:03 ` rakdver at gcc dot gnu dot org @ 2007-10-12 22:27 ` rakdver at gcc dot gnu dot org 2007-10-22 8:38 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: rakdver at gcc dot gnu dot org @ 2007-10-12 22:27 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from rakdver at gcc dot gnu dot org 2007-10-12 22:27 ------- Subject: Bug 33714 Author: rakdver Date: Fri Oct 12 22:26:47 2007 New Revision: 129277 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129277 Log: PR tree-optimization/33714 * tree-ssa-loop-ivopts.c (constant_multiple_of): Pass the arguments to division in the correct order. * gcc.dg/tree-ssa/pr33714.c: New test. Added: branches/gcc-4_2-branch/gcc/testsuite/gcc.dg/tree-ssa/pr33714.c Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/testsuite/ChangeLog branches/gcc-4_2-branch/gcc/tree-ssa-loop-ivopts.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/33714] [4.2 Regression] ivopts miscompiles insn-output.c 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org ` (4 preceding siblings ...) 2007-10-12 22:27 ` rakdver at gcc dot gnu dot org @ 2007-10-22 8:38 ` pinskia at gcc dot gnu dot org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu dot org @ 2007-10-22 8:38 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from pinskia at gcc dot gnu dot org 2007-10-22 08:38 ------- Fixed. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.2.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33714 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-22 8:38 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-10-09 15:52 [Bug middle-end/33714] New: ivopts miscompiles insn-output.c matz at gcc dot gnu dot org 2007-10-09 15:52 ` [Bug middle-end/33714] " matz at gcc dot gnu dot org 2007-10-09 16:16 ` [Bug middle-end/33714] [4.2 Regression] " rguenth at gcc dot gnu dot org 2007-10-09 16:51 ` rakdver at gcc dot gnu dot org 2007-10-12 3:03 ` rakdver at gcc dot gnu dot org 2007-10-12 22:27 ` rakdver at gcc dot gnu dot org 2007-10-22 8:38 ` pinskia at gcc dot gnu dot org
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).