Page 1 of 1

[RCC16] Error with static function pointers

Posted: Thu Feb 23, 2006 11:07 pm
by Dbug
I have been trying to compile Contiki with the OSDK, and got many problems, some I solved by hacking, some by correcting problems in the compiler/assembler/linker, but some I failed to solve, in particular some stuff in ctk.c that basicaly do the following:

Code: Select all

static void r1();

void (*pf)()=r1;

static void r1()     
{
}

void main()
{
}
This is the smallest sample of code I managed to do to produce the error:

C:\osdk\TMP\linked.s(3): 06b9:Label 'Ltest65' not defined

I am continuing my investigations !

Posted: Thu Feb 23, 2006 11:27 pm
by Dbug
Ok, I found out the difference between using static or not in the above code.

Without static we got that:

Code: Select all

_pf
	DW(_r1)
_r1
	RET
_main
	RET
while with static we got this:

Code: Select all

_pf
	DW(Ltest65)
Ltest66
	RET
_main
	RET
Obviously there is something bad in the label allocation.

Posted: Wed Mar 01, 2006 6:43 pm
by Euphoric
Hello Mike, I was on holiday last week, I'm going to look at this...
Did you try with different optimization levels ?

Posted: Wed Mar 01, 2006 7:36 pm
by Dbug
Nope, didn't tried that.
For what I know I'm using O2 as default optimisation setting because I was used to get bad generated code from time to time with O3

Posted: Thu Mar 02, 2006 10:55 am
by Euphoric
Hello Mike, I've sent you a bug-fix for rcc.
Not sure I used a valid email address though... please tell me if you haven't received anything...

Cheers,

Fabrice