mirror of https://github.com/cc65/cc65.git
tests for illegal pointer operations that must always fail
This commit is contained in:
parent
6ab197f364
commit
12a3e6841c
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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