From 12a3e6841c258faa66c269007f92529e742e23e0 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Fri, 10 Jul 2015 18:38:54 +0200 Subject: [PATCH] tests for illegal pointer operations that must always fail --- test/err/cc65150311-1.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-10.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-11.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-2.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-3.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-4.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-5.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-6.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-7.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-8.c | 26 ++++++++++++++++++++++++++ test/err/cc65150311-9.c | 26 ++++++++++++++++++++++++++ 11 files changed, 286 insertions(+) create mode 100644 test/err/cc65150311-1.c create mode 100644 test/err/cc65150311-10.c create mode 100644 test/err/cc65150311-11.c create mode 100644 test/err/cc65150311-2.c create mode 100644 test/err/cc65150311-3.c create mode 100644 test/err/cc65150311-4.c create mode 100644 test/err/cc65150311-5.c create mode 100644 test/err/cc65150311-6.c create mode 100644 test/err/cc65150311-7.c create mode 100644 test/err/cc65150311-8.c create mode 100644 test/err/cc65150311-9.c diff --git a/test/err/cc65150311-1.c b/test/err/cc65150311-1.c new file mode 100644 index 000000000..c4a836e39 --- /dev/null +++ b/test/err/cc65150311-1.c @@ -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 index 000000000..14e14d4fd --- /dev/null +++ b/test/err/cc65150311-10.c @@ -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 index 000000000..ffc8c9a02 --- /dev/null +++ b/test/err/cc65150311-11.c @@ -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 index 000000000..34c862ad8 --- /dev/null +++ b/test/err/cc65150311-2.c @@ -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 index 000000000..2bf8267a5 --- /dev/null +++ b/test/err/cc65150311-3.c @@ -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 index 000000000..0a7f44ec0 --- /dev/null +++ b/test/err/cc65150311-4.c @@ -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 index 000000000..41229ad67 --- /dev/null +++ b/test/err/cc65150311-5.c @@ -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 index 000000000..a08ab11d3 --- /dev/null +++ b/test/err/cc65150311-6.c @@ -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 index 000000000..71e6368f7 --- /dev/null +++ b/test/err/cc65150311-7.c @@ -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 index 000000000..d18dc0b2d --- /dev/null +++ b/test/err/cc65150311-8.c @@ -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 index 000000000..8cf805b07 --- /dev/null +++ b/test/err/cc65150311-9.c @@ -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; +} -- 2.39.5