added 3 more test

This commit is contained in:
mrdudz
2015-06-29 01:57:39 +02:00
parent d0e0b98b43
commit 72e4c10772
4 changed files with 158 additions and 0 deletions

45
test/val/cc65141002.c Executable file
View File

@@ -0,0 +1,45 @@
/*
!!DESCRIPTION!! forgetting to emit labels
!!ORIGIN!! Testsuite
!!LICENCE!! Public Domain
*/
/*
http://www.cc65.org/mailarchive/2014-10/11673.html
http://www.cc65.org/mailarchive/2014-10/11675.html
*/
#include <stdlib.h>
#include <stdio.h>
struct udata {
int (*u_sigvec[16])();
int u_argn;
int u_argn1;
};
struct udata udata;
#define sig (int)udata.u_argn
#define func (int (*)())udata.u_argn1
int _signal(void)
{
if (func != 0) {
goto nogood;
}
udata.u_sigvec[sig] = func;
return 0;
nogood:
return (-1);
}
int main(int n,char **args)
{
_signal();
printf("it works\n");
return 0;
}

57
test/val/cc65141022.c Executable file
View File

@@ -0,0 +1,57 @@
/*
!!DESCRIPTION!! struct base address dereferencing bug
!!ORIGIN!! Testsuite
!!LICENCE!! Public Domain
*/
#include <stdlib.h>
#include <stdio.h>
struct yywork
{
char verify, advance;
} yycrank[] =
{
{0,0}
};
struct yysvf
{
struct yywork *yystoff;
};
unsigned char fails = 0;
int main(int n, char **args)
{
struct yysvf *yystate;
struct yywork *yyt;
yystate->yystoff = yycrank;
yyt = yystate->yystoff;
if(yyt == yycrank) {
printf("yyt == yycrank (ok)\n");
} else {
printf("yyt != yycrank (fail)\n");
++fails;
}
if(yyt == yystate->yystoff) {
printf("yyt == yystate->yystoff (ok)\n");
} else {
printf("yyt != yystate->yystoff (fail)\n");
++fails;
}
if(yycrank == yystate->yystoff) {
printf("yycrank == yystate->yystoff (ok)\n");
} else {
printf("yycrank != yystate->yystoff (fail)\n");
++fails;
}
printf("fails: %d\n", fails);
return fails;
}