From: mrdudz Date: Fri, 10 Jul 2015 16:38:54 +0000 (+0200) Subject: tests for illegal pointer operations that must always fail X-Git-Tag: V2.16~250^2^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=12a3e6841c258faa66c269007f92529e742e23e0;p=cc65 tests for illegal pointer operations that must always fail --- 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; +}