OSDN Git Service

* builtins.c (fold_builtin_cabs): Protect the complex argument
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 19:20:42 +0000 (19:20 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 19:20:42 +0000 (19:20 +0000)
against multiple evaluation when optimizing cabs* into sqrt*.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71242 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/builtins.c

index d103a85..6754c80 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-09  Roger Sayle  <roger@eyesopen.com>
+
+       * builtins.c (fold_builtin_cabs): Protect the complex argument
+       against multiple evaluation when optimizing cabs* into sqrt*.
+
 Tue Sep  9 15:36:28 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
        * varasm.c (notice_global_symbol):  Properly deal with weak symbols.
index 290fac4..92e6a70 100644 (file)
@@ -5718,6 +5718,8 @@ fold_builtin_cabs (tree fndecl, tree arglist, tree type)
        {
          tree rpart, ipart, result, arglist;
 
+         arg = save_expr (arg);
+
          rpart = fold (build1 (REALPART_EXPR, type, arg));
          ipart = fold (build1 (IMAGPART_EXPR, type, arg));