Date: Wed, 6 Oct 1999 08:53:24 +0300 (EEST) From: Erhan Bilgili To: pgcc AT delorie DOT com Subject: Re: Compare elimination bug. In-Reply-To: <199910042229.AAA21543@riemann.math.jussieu.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id BAA17398 Reply-To: pgcc AT delorie DOT com X-Mailing-List: pgcc AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 5 Oct 1999, Loic Grenie wrote: > I've isolated the bug I told you about last time, that is the one that > caused a small loop to be miscompiled. I recall the problem: the file is > hello, didn't test it but you seem right. ill put this patch to the next release of the RPM packaged pgcc. thank you. > void func(void) > { > int i, tab[512]; > > for (i = 0; i < 511; i++) > tab[i+1] = tab[i]; > } > > is miscompiled with -O4 -mpentium and correctly with -fno-compare-elim. By > changing the file loop.c according to the following patch, the problem is > corrected for the given example. I think the patch cover all cases, but I'm > not a compiler specialist, so it would be better to have a good look at > it. (there could be some lines of offset since I also corrected a > misallocation in this file, already submitted to the list) > > Loïc > > --- loop.c.orig Mon Oct 4 22:30:22 1999 > +++ loop.c Tue Oct 5 00:16:17 1999 > @@ -10546,7 +10546,7 @@ > obfree(storage); > return 0; > } > - else if (!rtx_equal_p (SET_DEST (PATTERN (insn)), SET_DEST (bl->init_set))) > + else > { > new_rtx_element = (struct new_rtx *) alloca (sizeof (struct new_rtx)); > new_rtx_element->insn = insn; > @@ -10576,6 +10576,19 @@ > obfree (storage); > return 0; > } > + } > + > + if (rtx_equal_p (SET_DEST (PATTERN (insn)), SET_DEST (bl->init_set))) > + { > + emit_insn_after(gen_rtx (SET, > + GET_MODE(SET_DEST(PATTERN(insn))), > + SET_DEST(PATTERN(insn)), > + gen_rtx(PLUS, > + GET_MODE(SET_DEST(PATTERN(insn))), > + SET_DEST(PATTERN(insn)), > + gen_rtx(CONST_INT, 0, > + -adjust_val))), > + insn); > } > } > } >