www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1999/10/06/08:04:55

Date: Wed, 6 Oct 1999 08:53:24 +0300 (EEST)
From: Erhan Bilgili <erhan AT altay DOT adm DOT deu DOT edu DOT tr>
To: pgcc AT delorie DOT com
Subject: Re: Compare elimination bug.
In-Reply-To: <199910042229.AAA21543@riemann.math.jussieu.fr>
Message-ID: <Pine.LNX.4.10.9910060849590.7441-100000@altay.adm.deu.edu.tr>
MIME-Version: 1.0
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


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);
>  	        }
>  	    }
>  	}
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019