[RCC16] Error with static function pointers

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

[RCC16] Error with static function pointers

Post 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 !
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post 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.
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

Hello Mike, I was on holiday last week, I'm going to look at this...
Did you try with different optimization levels ?
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post 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
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post 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
Post Reply