[cc65] cc65 forgetting to emit labels

From: Alan Cox <etchedpixels1gmail.com>
Date: 2014-10-02 02:02:38
I hit this trying to build some code I've got that's fine on Z80 and 6809 ;-)

It breaks in several spots with cc65 where cc65 forgets to emit the
labels for the goto statements - the code is there but with no label
and it them blows up linking


The shortest example I can engineer so far (much cut down from the
original where the goto makes sense) is

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);
}

I've done some poking at the compiler - it generates the label and I
see it add a label for "nogood" as L007. It then hits the label and
proceeds to add another label for nogood as L000C, and then warn me
nogood is defined but never used

The really odd bit is that if I comment out the assignment udata.u_
etc then the expected happens and the label 7 is re-used for the
second lookup and correctly generated in the output. Likewise if the
values being processed are "int" rather than function pointers the
problem goes away.

Sticking an mcheck(NULL) in the code doesn't turn up any reported
memory corruptions


Alan
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Oct 2 02:02:59 2014

This archive was generated by hypermail 2.1.8 : 2014-10-02 02:03:01 CEST