aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c')
-rw-r--r--gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c
new file mode 100644
index 000000000..bd024065c
--- /dev/null
+++ b/gcc-4.4.3/gcc/testsuite/gcc.dg/torture/mversn1.c
@@ -0,0 +1,31 @@
+/* Check that __builtin_dispatch gets converted and the executable runs fine.
+ Since featureTest () returns 1, foo should be called and return 0. Cloning
+ and Hoisting is not even turned on here. */
+/* { dg-do run } */
+
+int __attribute__ ((version_selector))
+featureTest ()
+{
+ return 1;
+}
+
+int __attribute__ ((cold))
+foo ()
+{
+ return 0;
+}
+
+int __attribute__ ((cold))
+bar ()
+{
+ return 1;
+}
+
+int __attribute__ ((cold))
+main ()
+{
+ int a, b;
+ a = __builtin_dispatch (featureTest, (void *)foo, (void *) bar);
+ b = __builtin_dispatch (featureTest, (void *)bar, (void *) foo);
+ return a * b;
+}