OSDN Git Service

PR rtl-optimization/36017
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Apr 2008 22:33:48 +0000 (22:33 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Apr 2008 22:33:48 +0000 (22:33 +0000)
* builtins.c (expand_errno_check): Clear CALL_EXPR_TAILCALL before
expanding the library call.

* gcc.dg/pr36017.c: New test.

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

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr36017.c [new file with mode: 0644]

index 6132b7f..9a057f3 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/36017
+       * builtins.c (expand_errno_check): Clear CALL_EXPR_TAILCALL before
+       expanding the library call.
+
 2008-04-22  Ian Lance Taylor  <iant@google.com>
 
        * fold-const.c (pointer_may_wrap_p): Call int_size_in_bytes rather
index d5c4f92..761a658 100644 (file)
@@ -1804,6 +1804,9 @@ expand_errno_check (tree exp, rtx target)
     }
 #endif
 
+  /* Make sure the library call isn't expanded as a tail call.  */
+  CALL_EXPR_TAILCALL (exp) = 0;
+
   /* We can't set errno=EDOM directly; let the library call do it.
      Pop the arguments right away in case the call gets deleted.  */
   NO_DEFER_POP;
index cf689a4..435f081 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/36017
+       * gcc.dg/pr36017.c: New test.
+
 2008-04-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/35747
diff --git a/gcc/testsuite/gcc.dg/pr36017.c b/gcc/testsuite/gcc.dg/pr36017.c
new file mode 100644 (file)
index 0000000..fa36927
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR rtl-optimization/36017 */
+/* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */
+/* { dg-options "-O2 -lm" } */
+
+extern double sqrt (double);
+extern void abort (void);
+
+__attribute__((noinline)) double
+foo (double a)
+{
+  double b, c, d = 0.7;
+  if (a <= d)
+    b = sqrt (d * a);
+  else
+    {
+      c = (1.0 - d) * (1.0 - a);
+      b = c > 0 ? 1.0 - sqrt (c) : 1.0;
+    }
+  return b;
+}
+
+int
+main (void)
+{
+  double c = foo (0.5);
+  if (c > 0.5917)
+    abort ();
+  return 0;
+}