From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joern Rennecke To: tege@pdc.kth.se (Torbjorn Granlund), wilson@cygnus.com, law@cygnus.com Cc: egcs@cygnus.com Subject: x86 failure on loop reversal Date: Fri, 03 Apr 1998 21:52:00 -0000 Message-id: <199804030112.CAA17918@phal.cygnus.co.uk> X-SW-Source: 1998-04/msg00116.html The appended tests fails for egcs at -O2. This is a synthetic test to demonstrate a bug I found while looking for some possible improvements to check_dbra_loop: when the initial value is normalized, an overflow can occur. I suggest that if we did a normalisation that results in a negative initial value, we change the comparison into an unsigned one. Actually, we could do this change always when we erverse the loop, and then we could do away with the NONNEG note. However, changing a signed compare into an unsigned compare might fail sometimes (depending on how well we can grok the RTL and what the target accepts), so it is better not to have to rely on this. int f() { int j = 1; int i; for (i = -0x80000000; i < 0x60000000; i += 0x10000000) j <<= 1; return j; } int main () { if (f () != 16384) abort (); return 0; }