Merge branch 'master' into StaticConst
This commit is contained in:
@@ -11,7 +11,6 @@ ifdef CMD_EXE
|
||||
NULLDEV = nul:
|
||||
MKDIR = mkdir $(subst /,\,$1)
|
||||
RMDIR = -rmdir /s /q $(subst /,\,$1)
|
||||
DEL = del /f $(subst /,\,$1)
|
||||
else
|
||||
S = /
|
||||
NOT = !
|
||||
@@ -19,7 +18,6 @@ else
|
||||
NULLDEV = /dev/null
|
||||
MKDIR = mkdir -p $1
|
||||
RMDIR = $(RM) -r $1
|
||||
DEL = $(RM) $1
|
||||
endif
|
||||
|
||||
ifdef QUIET
|
||||
@@ -30,14 +28,16 @@ endif
|
||||
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),..$S..$Sbin$Scl65,cl65)
|
||||
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
|
||||
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
|
||||
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
|
||||
|
||||
WORKDIR = ..$S..$Stestwrk$Smisc
|
||||
|
||||
OPTIONS = g O Os Osi Osir Osr Oi Oir Or
|
||||
|
||||
DIFF = $(WORKDIR)$Sisequal$(EXE)
|
||||
ISEQUAL = $(WORKDIR)$Sisequal$(EXE)
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O2
|
||||
@@ -50,15 +50,10 @@ TESTS += $(foreach option,$(OPTIONS),$(SOURCES:%.c=$(WORKDIR)/%.$(option).65c02.
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
# The same input file is processed with different cl65 args,
|
||||
# but cl65 uses the input file name to make the temp file name,
|
||||
# and they stomp each other.
|
||||
.NOTPARALLEL:
|
||||
|
||||
$(WORKDIR):
|
||||
$(call MKDIR,$(WORKDIR))
|
||||
|
||||
$(DIFF): ../isequal.c | $(WORKDIR)
|
||||
$(ISEQUAL): ../isequal.c | $(WORKDIR)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
define PRG_template
|
||||
@@ -67,44 +62,65 @@ define PRG_template
|
||||
$(WORKDIR)/bug760.$1.$2.prg: bug760.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug760.$1.$2.prg)
|
||||
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# should compile, but gives an error
|
||||
$(WORKDIR)/bug1209-ind-goto-rev.$1.$2.prg: bug1209-ind-goto-rev.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug1209-ind-goto-rev.$1.$2.prg)
|
||||
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
|
||||
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
|
||||
$(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
|
||||
|
||||
# should compile, but gives an error
|
||||
$(WORKDIR)/bug1209-ind-goto-rev-2.$1.$2.prg: bug1209-ind-goto-rev-2.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug1209-ind-goto-rev-2.$1.$2.prg)
|
||||
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
|
||||
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
|
||||
$(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
|
||||
|
||||
# should compile, but gives an error
|
||||
$(WORKDIR)/bug1209-ind-goto-rev-3.$1.$2.prg: bug1209-ind-goto-rev-3.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug1209-ind-goto-rev-3.$1.$2.prg)
|
||||
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
|
||||
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
|
||||
$(NOT) $(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
|
||||
|
||||
# should compile, but gives an error
|
||||
$(WORKDIR)/pptest2.$1.$2.prg: pptest2.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/pptest2.$1.$2.prg)
|
||||
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# this should fail to compile, because there are errors in the code
|
||||
# instead, the compiler crashes
|
||||
$(WORKDIR)/bug1113.$1.$2.prg: bug1113.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "compiler crashes but should give an error."
|
||||
$(if $(QUIET),echo misc/bug1113.$1.$2.prg)
|
||||
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# should compile, but then hangs in an endless loop
|
||||
$(WORKDIR)/endless.$1.$2.prg: endless.c | $(WORKDIR)
|
||||
$(if $(QUIET),echo misc/endless.$1.$2.prg)
|
||||
$(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
|
||||
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
|
||||
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
|
||||
$(NOT) $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) $(NULLERR)
|
||||
|
||||
# these need reference data that can't be generated by a host-compiled program,
|
||||
# in a useful way
|
||||
$(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF) | $(WORKDIR)
|
||||
$(WORKDIR)/limits.$1.$2.prg: limits.c $(ISEQUAL) | $(WORKDIR)
|
||||
$(if $(QUIET),echo misc/limits.$1.$2.prg)
|
||||
$(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
$(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
|
||||
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
|
||||
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
|
||||
$(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.$2.out
|
||||
$(DIFF) $(WORKDIR)/limits.$1.$2.out limits.ref
|
||||
$(ISEQUAL) $(WORKDIR)/limits.$1.$2.out limits.ref
|
||||
|
||||
$(WORKDIR)/goto.$1.$2.prg: goto.c $(DIFF) | $(WORKDIR)
|
||||
$(WORKDIR)/goto.$1.$2.prg: goto.c $(ISEQUAL) | $(WORKDIR)
|
||||
$(if $(QUIET),echo misc/goto.$1.$2.prg)
|
||||
$(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out
|
||||
$(DIFF) $(WORKDIR)/goto.$1.$2.out goto.ref
|
||||
$(CC65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out
|
||||
$(ISEQUAL) $(WORKDIR)/goto.$1.$2.out goto.ref
|
||||
|
||||
# the rest are tests that fail currently for one reason or another
|
||||
$(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
# $(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT)
|
||||
|
||||
endef # PRG_template
|
||||
@@ -114,4 +130,3 @@ $(foreach option,$(OPTIONS),$(eval $(call PRG_template,$(option),65c02)))
|
||||
|
||||
clean:
|
||||
@$(call RMDIR,$(WORKDIR))
|
||||
@$(call DEL,$(SOURCES:.c=.o))
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
/* bug #1113 - Compiler crashes when calling functions "redefined" as other types */
|
||||
|
||||
void f() {}
|
||||
|
||||
int f;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
f();
|
||||
return 0;
|
||||
}
|
||||
54
test/misc/bug1209-ind-goto-rev-2.c
Normal file
54
test/misc/bug1209-ind-goto-rev-2.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2020 The cc65 Authors
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Test of indirect goto without dynamic labels and order label def, label ref, goto.
|
||||
https://github.com/cc65/cc65/issues/1209
|
||||
This should compile and should be moved to tests/val/ when the bug is fixed.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* When operating correctly, this returns 0. */
|
||||
static unsigned char y = 0;
|
||||
int f (void) {
|
||||
L: if (y) return 0;
|
||||
{
|
||||
static const void *const x[1] = {&&L};
|
||||
y = 1;
|
||||
goto *x[0];
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char failures = 0;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (f () != 0) failures++;
|
||||
|
||||
if (failures == 0) {
|
||||
printf ("PASS\n");
|
||||
} else {
|
||||
printf ("FAIL\n");
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
||||
52
test/misc/bug1209-ind-goto-rev-3.c
Normal file
52
test/misc/bug1209-ind-goto-rev-3.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2020 The cc65 Authors
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Test of indirect goto without dynamic labels and order label ref, label def, goto.
|
||||
https://github.com/cc65/cc65/issues/1209
|
||||
This should compile and should be moved to tests/val/ when the bug is fixed.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* When operating correctly, this returns 0. */
|
||||
static unsigned char y = 0;
|
||||
int f (void) {
|
||||
static const void *const x[1] = {&&L};
|
||||
L: if (y) return 0;
|
||||
y = 1;
|
||||
goto *x[0];
|
||||
}
|
||||
|
||||
static unsigned char failures = 0;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (f () != 0) failures++;
|
||||
|
||||
if (failures == 0) {
|
||||
printf ("PASS\n");
|
||||
} else {
|
||||
printf ("FAIL\n");
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
||||
53
test/misc/bug1209-ind-goto-rev.c
Normal file
53
test/misc/bug1209-ind-goto-rev.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2020 The cc65 Authors
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Test of indirect goto with dynamic labels and order label def, label ref, goto.
|
||||
https://github.com/cc65/cc65/issues/1209
|
||||
This should compile and should be moved to tests/val/ when the bug is fixed.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* When operating correctly, this returns 0. */
|
||||
int f (void)
|
||||
{
|
||||
static void *x[1];
|
||||
/* Define the label before referencing it with indirect label syntax. */
|
||||
L: if (x[0] != 0) return 0;
|
||||
x[0] = &&L;
|
||||
goto *x[0];
|
||||
}
|
||||
|
||||
static unsigned char failures = 0;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
if (f () != 0) failures++;
|
||||
|
||||
if (failures == 0) {
|
||||
printf ("PASS\n");
|
||||
} else {
|
||||
printf ("FAIL\n");
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
||||
Reference in New Issue
Block a user