builtins.c (fold_builtin_cabs): Protect the complex argument against multiple evaluat...
authorRoger Sayle <roger@eyesopen.com>
Tue, 9 Sep 2003 19:20:42 +0000 (19:20 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 9 Sep 2003 19:20:42 +0000 (19:20 +0000)
* builtins.c (fold_builtin_cabs): Protect the complex argument
against multiple evaluation when optimizing cabs* into sqrt*.

From-SVN: r71242

gcc/ChangeLog
gcc/builtins.c

index d103a85e21be52f27f34fc6eb1fcf5707ecf0c40..6754c80b56e817c23e15b191b9ae18a2fb6682ec 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 290fac49e8c6fa3eb3ea14c96e066ecf12f2e5ba..92e6a7065140609f112d4f6b765af7726978ddda 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));