patch from Uz that makes some illegal operations on pointers error out

This commit is contained in:
mrdudz
2015-07-10 14:27:49 +02:00
parent bdb01212c2
commit 6ab197f364
3 changed files with 89 additions and 5 deletions

38
test/val/cc65150311.c Normal file
View File

@@ -0,0 +1,38 @@
/*
!!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);
/* the following are not valid C and should go into seperate tests that MUST fail */
/*
++p;
n = (p > &func);
n = (p > func);
n = func - func;
n = func - &func;
n = &func - func;
n = &func - &func;
n = p - &func;
n = p - func;
n = &func - p;
n = func - p;
*/
return 0;
}