This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, middle-end]: Prevent invalid transformations for modes with signed zeros.


Hello!

Current gcc transforms "x >= 0.0 ? x : -x" into fabs(), which is wrong
for modes with signed zeros [when x equals -0.0, this code returns
-0.0, where fabs() returns 0.0]. Attached patch fixes a couple of
places where this wrong transformation is performed, including
transforms to ABS_EXPR, MAX_EXPR and MIN_EXPR.

2008-03-04  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/35456
	* fold-const.c (fold_cond_expr_with_comparison): Prevent
	transformations for modes that have signed zeros.
	* ifcvt.c (noce_try_abs): Ditto.

2008-03-04  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/35456
	* gcc.c-torture/execute/pr35456.c: New test.

Patch was bootstrapped and regression tested on i686-pc-linux-gnu. OK
for mainline?

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]