CS_MergeLabels: Keep labels referenced by data

Partial fix for ICE in #1211.  This may fix enough to allow #1049 to be
fixed.

When merging labels, keep the first label with a ref that has no JumpTo;
this is a data segment label, used by computed gotos.

The real fix is to track and rewrite labels in data, but this is more
involved.
This commit is contained in:
Jesse Rosenstock
2020-08-24 22:24:00 +02:00
committed by Oliver Schmidt
parent 037a806036
commit 81550ca1ee
3 changed files with 47 additions and 3 deletions

View File

@@ -21,7 +21,8 @@
/*
Test of indirect goto with label merge ICE.
https://github.com/cc65/cc65/issues/1211
This should compile and should be moved to tests/val/ when the bug is fixed.
This test case works because CS_MergeLabels has a hack to keep the "unreferenced" label
(i.e. the one referenced in a data segment).
*/
#include <stdio.h>