mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 03:46:53 -05:00
backport: re PR middle-end/21032 (With -frounding-math, incorrectly reorders unary minus)
2006-11-13 Richard Guenther <rguenther@suse.de> Backport from mainline: 2006-10-23 Richard Guenther <rguenther@suse.de> PR middle-end/21032 * convert.c (convert_to_real): Fold (float)-x to -(float)x only if not flag_rounding_math. * gcc.dg/pr21032.c: New testcase. From-SVN: r118751
This commit is contained in:
committed by
Richard Biener
parent
4f67e1c6ab
commit
4063073db5
@@ -1,3 +1,12 @@
|
||||
2006-11-13 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
Backport from mainline:
|
||||
2006-10-23 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/21032
|
||||
* convert.c (convert_to_real): Fold (float)-x to -(float)x
|
||||
only if not flag_rounding_math.
|
||||
|
||||
2006-11-12 Jason Merrill <jason@redhat.com>
|
||||
Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
|
||||
@@ -248,10 +248,12 @@ convert_to_real (tree type, tree expr)
|
||||
if (itype != type && FLOAT_TYPE_P (type))
|
||||
switch (TREE_CODE (expr))
|
||||
{
|
||||
/* Convert (float)-x into -(float)x. This is always safe. */
|
||||
/* Convert (float)-x into -(float)x. This is safe for
|
||||
round-to-nearest rounding mode. */
|
||||
case ABS_EXPR:
|
||||
case NEGATE_EXPR:
|
||||
if (TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr)))
|
||||
if (!flag_rounding_math
|
||||
&& TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr)))
|
||||
return build1 (TREE_CODE (expr), type,
|
||||
fold (convert_to_real (type,
|
||||
TREE_OPERAND (expr, 0))));
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2006-11-13 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
Backport form mainline:
|
||||
2006-10-23 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/21032
|
||||
* gcc.dg/pr21032.c: New testcase.
|
||||
|
||||
2006-11-12 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/29699
|
||||
|
||||
11
gcc/testsuite/gcc.dg/pr21032.c
Normal file
11
gcc/testsuite/gcc.dg/pr21032.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-optimized -frounding-math" } */
|
||||
|
||||
void bar(float x);
|
||||
void foo(double x)
|
||||
{
|
||||
bar(-x);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "-\\(float\\)" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||
Reference in New Issue
Block a user