[Bug middle-end/17894] [4.0 Regression] div/compare folding incorrect

cvs-commit at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Oct 9 15:48:00 GMT 2004


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-09 15:48 -------
Subject: Bug 17894

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-10-09 15:48:24

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: divcmp-4.c 

Log message:
	PR middle-end/17894
	* fold-const.c (fold_div_compare): When optimizing X/C1 op C2, the
	relational comparison operator op needs to be swapped/reversed when
	C1 is negative.  i.e. X/-10 < 1 becomes X >= -9, not X < -9.
	
	* gcc.c-torture/execute/divcmp-4.c: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5819&r2=2.5820
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.466&r2=1.467
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4418&r2=1.4419
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/divcmp-4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17894



More information about the Gcc-bugs mailing list