summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/call-trap-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/call-trap-1.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c b/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c
new file mode 100644
index 000000000..aa226e745
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/call-trap-1.c
@@ -0,0 +1,26 @@
+/* Undefined behavior from a call to a function cast to a different
+ type does not appear until after the function designator and
+ arguments have been evaluated. PR 38483. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+
+extern void exit (int);
+extern void abort (void);
+
+int
+foo (void)
+{
+ exit (0);
+ return 0;
+}
+
+void
+bar (void)
+{
+}
+
+int
+main (void)
+{
+ ((long (*)(int))bar) (foo ());
+ abort ();
+}