summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/lto/20110201-1_0.c')
-rw-r--r--gcc/testsuite/gcc.dg/lto/20110201-1_0.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lto/20110201-1_0.c b/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
new file mode 100644
index 00000000000..f5d335572ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
@@ -0,0 +1,19 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options { { -O0 -flto } } } */
+/* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
+/* { dg-require-linker-plugin "" } */
+
+/* We require a linker plugin because otherwise we'd need to link
+ against libm which we are not sure here has cabs on all targets.
+ This is because collect2 invokes ld on the -O0 object code
+ which does not have folded cabs. */
+
+double cabs(_Complex double);
+double __attribute__((used))
+foo (_Complex double x, int b)
+{
+ if (b)
+ x = 0;
+ return cabs(x);
+}
+int main() { return 0; }