From c21372c41eb1f5995048a67bfc9512d860c986cb Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 18 Mar 2010 16:07:53 +0000 Subject: re PR middle-end/43419 (gcc replaces pow(x, 0.5) by sqrt(x), invalid when x is -0) PR middle-end/43419 * builtins.c (expand_builtin_pow): Don't transform pow(x, 0.5) into sqrt(x) if we need to preserve signed zeros. testsuite/ * gcc.dg/pr43419.c: New testcase. From-SVN: r157543 --- gcc/builtins.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/builtins.c') diff --git a/gcc/builtins.c b/gcc/builtins.c index 1e089ef9..705a255 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2980,7 +2980,10 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget) && ((flag_unsafe_math_optimizations && optimize_insn_for_speed_p () && powi_cost (n/2) <= POWI_MAX_MULTS) - || n == 1)) + /* Even the c==0.5 case cannot be done unconditionally + when we need to preserve signed zeros, as + pow (-0, 0.5) is +0, while sqrt(-0) is -0. */ + || (!HONOR_SIGNED_ZEROS (mode) && n == 1))) { tree call_expr = build_call_nofold (fn, 1, narg0); /* Use expand_expr in case the newly built call expression -- cgit v1.1