]> git.sur5r.net Git - cc65/commitdiff
tests for illegal pointer operations that must always fail 176/head
authormrdudz <mrdudz@users.noreply.github.com>
Fri, 10 Jul 2015 16:38:54 +0000 (18:38 +0200)
committermrdudz <mrdudz@users.noreply.github.com>
Fri, 10 Jul 2015 16:38:54 +0000 (18:38 +0200)
test/err/cc65150311-1.c [new file with mode: 0644]
test/err/cc65150311-10.c [new file with mode: 0644]
test/err/cc65150311-11.c [new file with mode: 0644]
test/err/cc65150311-2.c [new file with mode: 0644]
test/err/cc65150311-3.c [new file with mode: 0644]
test/err/cc65150311-4.c [new file with mode: 0644]
test/err/cc65150311-5.c [new file with mode: 0644]
test/err/cc65150311-6.c [new file with mode: 0644]
test/err/cc65150311-7.c [new file with mode: 0644]
test/err/cc65150311-8.c [new file with mode: 0644]
test/err/cc65150311-9.c [new file with mode: 0644]

diff --git a/test/err/cc65150311-1.c b/test/err/cc65150311-1.c
new file mode 100644 (file)
index 0000000..c4a836e
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    ++p; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-10.c b/test/err/cc65150311-10.c
new file mode 100644 (file)
index 0000000..14e14d4
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = &func - p; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-11.c b/test/err/cc65150311-11.c
new file mode 100644 (file)
index 0000000..ffc8c9a
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = func - p; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-2.c b/test/err/cc65150311-2.c
new file mode 100644 (file)
index 0000000..34c862a
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = (p > &func); /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-3.c b/test/err/cc65150311-3.c
new file mode 100644 (file)
index 0000000..2bf8267
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = (p > func); /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-4.c b/test/err/cc65150311-4.c
new file mode 100644 (file)
index 0000000..0a7f44e
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = func - func; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-5.c b/test/err/cc65150311-5.c
new file mode 100644 (file)
index 0000000..41229ad
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = func - &func; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-6.c b/test/err/cc65150311-6.c
new file mode 100644 (file)
index 0000000..a08ab11
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = &func - func; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-7.c b/test/err/cc65150311-7.c
new file mode 100644 (file)
index 0000000..71e6368
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = &func - &func; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-8.c b/test/err/cc65150311-8.c
new file mode 100644 (file)
index 0000000..d18dc0b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = p - &func; /* invalid C */
+
+    return 0;
+}
diff --git a/test/err/cc65150311-9.c b/test/err/cc65150311-9.c
new file mode 100644 (file)
index 0000000..8cf805b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = p - func; /* invalid C */
+
+    return 0;
+}