mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
tests for illegal pointer operations that must always fail
This commit is contained in:
parent
6ab197f364
commit
12a3e6841c
26
test/err/cc65150311-1.c
Normal file
26
test/err/cc65150311-1.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-10.c
Normal file
26
test/err/cc65150311-10.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-11.c
Normal file
26
test/err/cc65150311-11.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-2.c
Normal file
26
test/err/cc65150311-2.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-3.c
Normal file
26
test/err/cc65150311-3.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-4.c
Normal file
26
test/err/cc65150311-4.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-5.c
Normal file
26
test/err/cc65150311-5.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-6.c
Normal file
26
test/err/cc65150311-6.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-7.c
Normal file
26
test/err/cc65150311-7.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-8.c
Normal file
26
test/err/cc65150311-8.c
Normal file
@ -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;
|
||||
}
|
26
test/err/cc65150311-9.c
Normal file
26
test/err/cc65150311-9.c
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user