From ce6ee1b8919e40a25cd4dddad4eacbc9256160ce Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 28 Aug 2022 03:43:54 +0200 Subject: [PATCH] test some more possible cases and move test into test/val --- test/misc/Makefile | 8 -------- test/misc/bug1252.c | 19 ------------------- test/val/bug1252.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 27 deletions(-) delete mode 100644 test/misc/bug1252.c create mode 100644 test/val/bug1252.c diff --git a/test/misc/Makefile b/test/misc/Makefile index e761b1e3e..e77d37b29 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -58,14 +58,6 @@ $(ISEQUAL): ../isequal.c | $(WORKDIR) define PRG_template -# should compile, but gives an error -$(WORKDIR)/bug1252.$1.$2.prg: bug1252.c | $(WORKDIR) - @echo "FIXME: " $$@ "currently does not compile." - $(if $(QUIET),echo misc/bug1252.$1.$2.prg) - $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR) - $(NOT) $(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)/bug1768.$1.$2.prg: bug1768.c | $(WORKDIR) @echo "FIXME: " $$@ "currently does not compile." diff --git a/test/misc/bug1252.c b/test/misc/bug1252.c deleted file mode 100644 index 599aa064b..000000000 --- a/test/misc/bug1252.c +++ /dev/null @@ -1,19 +0,0 @@ - -#include - -int main(void) -{ -// this works -c_label: - asm("inx\n" - "bne %g\n", - c_label); - -// this does not work -c_label2: - asm("inx\n" - "bne %g \n", - c_label2); - - return EXIT_SUCCESS; -} diff --git a/test/val/bug1252.c b/test/val/bug1252.c new file mode 100644 index 000000000..ab4fd21fc --- /dev/null +++ b/test/val/bug1252.c @@ -0,0 +1,45 @@ + +// bug #1252 - inline asm: cc65 chokes on label ref if space/tab follows + +#include + +int main(void) +{ +// first test the recommended way to use labels in inline assembly: + +// this works +c_label: + asm("inx\n" + "bne %g\n", + c_label); + +// this does not work +c_label2: + asm("inx\n" + "bne %g \n", + c_label2); + +// now the following is from the original bug report. note that using labels +// this way only works by chance - the name of the label may clash with +// generated labels + +// this works + asm("label1: inx\n" + "bne label1\n"); + +// this does not work + asm("label2: inx\n" + "bne label2 \n"); + +// a variant of the above using local labels. + +// this works + asm("@label1: inx\n" + "bne @label1\n"); + +// this does not work + asm("@label2: inx\n" + "bne @label2 \n"); + + return EXIT_SUCCESS; +}