summaryrefslogtreecommitdiff
path: root/test/regression/funptr2.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression/funptr2.c')
-rw-r--r--test/regression/funptr2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/regression/funptr2.c b/test/regression/funptr2.c
new file mode 100644
index 0000000..5c31dd2
--- /dev/null
+++ b/test/regression/funptr2.c
@@ -0,0 +1,14 @@
+/* Comparisons of pointers to functions */
+
+#include <stdio.h>
+
+int f(void) { return 0; }
+int g(void) { return 1; }
+
+int main(void) {
+ printf ("f == f is %d\n", &f == &f);
+ printf ("f == g is %d\n", &f == &g);
+ /* The following is undefined behavior */
+ printf ("f + 1 == f is %d\n", ((char *) &f) + 1 == (char *) &f);
+ return 0;
+}