aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/builtin-noret-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-noret-2.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
new file mode 100644
index 00000000000..9b94a4c2a8e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-noret-2.c
@@ -0,0 +1,73 @@
+/* Test for builtin noreturn attributes when the visible declarations
+ are function-local. Modified from builtin-noret-1.c by Zack Weinberg
+ <zack@codesourcery.com>. */
+/* { dg-options "-multiply_defined suppress" { target powerpc-*-darwin* } } */
+/* { dg-do link } */
+
+extern void tabort (void);
+extern void texit (void);
+extern void t_exit (void);
+extern void t_Exit (void);
+
+extern void link_failure (void);
+
+int
+main (void)
+{
+ volatile int i = 0;
+ if (i)
+ tabort ();
+ if (i)
+ texit ();
+ if (i)
+ t_exit ();
+ if (i)
+ t_Exit ();
+ exit (0);
+}
+
+void
+tabort (void)
+{
+ extern void abort (void);
+ abort ();
+ link_failure ();
+}
+
+void
+texit (void)
+{
+ extern void exit (int);
+ exit (1);
+ link_failure ();
+}
+
+void
+t_exit (void)
+{
+ extern void _exit (int);
+ _exit (1);
+ link_failure ();
+}
+
+/* Some non-Unix libcs might not have _exit. */
+void
+_exit (int i)
+{
+ abort ();
+}
+
+void
+t_Exit (void)
+{
+ extern void _Exit (int);
+ _Exit (1);
+ link_failure ();
+}
+
+/* Some libcs might not have _Exit. */
+void
+_Exit (int i)
+{
+ abort ();
+}