mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +00:00
commit
2cdba854a1
@ -52,6 +52,10 @@ $(WORKDIR)/sitest%prg: sitest.c
|
||||
@echo "FIXME: " $@ "currently will fail."
|
||||
-$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
|
||||
# -$(SIM65) $(SIM65FLAGS) $@
|
||||
$(WORKDIR)/cc65141011%prg: cc65141011.c
|
||||
@echo "FIXME: " $@ "currently will fail."
|
||||
$(CL65) $(subst .,,$(*:.o%=-O%)) $(CC65FLAGS) $< -o $@
|
||||
-$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
clean:
|
||||
-@$(call DEL,$(TESTS))
|
||||
|
52
test/misc/cc65141011.c
Executable file
52
test/misc/cc65141011.c
Executable file
@ -0,0 +1,52 @@
|
||||
|
||||
/*
|
||||
!!DESCRIPTION!! equality problem
|
||||
!!ORIGIN!! Testsuite
|
||||
!!LICENCE!! Public Domain
|
||||
*/
|
||||
|
||||
/*
|
||||
different result depending on whether constant is on left or right side
|
||||
|
||||
http://www.cc65.org/mailarchive/2014-10/11680.html
|
||||
http://www.cc65.org/mailarchive/2014-10/11683.html
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static unsigned char fails = 4;
|
||||
static unsigned char bad[3], good[3];
|
||||
|
||||
int main(int n, char **args)
|
||||
{
|
||||
unsigned char joy_state = 0x7e;
|
||||
unsigned a, b;
|
||||
|
||||
/* NOTE: somehow it only fails in the printf statement, the other stuff
|
||||
below works! */
|
||||
printf("bad: %u\n", 0 == (joy_state & 1) );
|
||||
printf("good: %u\n", (joy_state & 1) == 0 );
|
||||
|
||||
sprintf(bad, "%u", 0 == (joy_state & 1) );
|
||||
sprintf(good, "%u", (joy_state & 1) == 0 );
|
||||
|
||||
printf("bad: %u\n", bad[0] - '0' );
|
||||
printf("good: %u\n", good[0] - '0' );
|
||||
|
||||
fails -= bad[0] - '0';
|
||||
fails -= good[0] - '0';
|
||||
|
||||
if (0 == (joy_state & 1)) fails--;
|
||||
if ((joy_state & 1) == 0) fails--;
|
||||
|
||||
printf("fails: %u\n", fails );
|
||||
|
||||
a = 0 == (joy_state & 1);
|
||||
b = (joy_state & 1) == 0;
|
||||
|
||||
printf("a: %u\n", a );
|
||||
printf("b: %u\n", b );
|
||||
|
||||
return fails;
|
||||
}
|
@ -45,12 +45,8 @@ $(WORKDIR)/%.ref: %.c
|
||||
#
|
||||
$(WORKDIR)/init%prg: CC65FLAGS += -Wc --all-cdecl
|
||||
$(WORKDIR)/switch.%rg: CC65FLAGS += -Wc --all-cdecl
|
||||
|
||||
# Also, yacc.c does some things that fail when stack operations are optimized.
|
||||
# Therefore, don't optimize them.
|
||||
#
|
||||
$(WORKDIR)/yacc.%rg: CC65FLAGS += -Wc --all-cdecl,--disable-opt,OptStackOps
|
||||
$(WORKDIR)/yaccdbg%prg: CC65FLAGS += -Wc --all-cdecl,--disable-opt,OptStackOps
|
||||
$(WORKDIR)/yacc.%rg: CC65FLAGS += -Wc --all-cdecl
|
||||
$(WORKDIR)/yaccdbg%prg: CC65FLAGS += -Wc --all-cdecl
|
||||
|
||||
$(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
|
45
test/val/cc65141002.c
Executable file
45
test/val/cc65141002.c
Executable 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
57
test/val/cc65141022.c
Executable 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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user