I’m trying to declare a far function pointer(32-bit pointer pointing to a function) with RL78 GCC, but I can’t find how to do this.

CC-RL seems to be able to do this by writing like below, so I tried it, but got an error.

Far function pointer declaration in CC-RL:

void (__far* fp)(void);

The  error message I got:

error: expected identifier or ‘(‘ before ‘__far’
void (__far* fp)(void);

Is there any way to declare a far function pointer in RL78 GCC?



By the way, I tried the other patterns to declare far function pointer and in one pattern I got an internal compiler error.

The code and error message are listed below.

In the example below, the function pointer is declared as a global variable.

When the function pointer is declared as a local variable,  no error message appeared but the pointer pointed to a wrong address.



typedef void (FP)(void);

__far FP* fp;

__attribute__((section(“.far_area”)))   // dummy function is placed at 0x10000
void dummy(void){}

int main(void){
fp = dummy;
return 0;


Error message:

In function ‘main’:
internal compiler error: in change_address_1, at emit-rtl.c:1932
0x62f49c change_address_1
0x631b36 change_address(rtx_def*, machine_mode, rtx_def*)
0x9e21b7 transcode_memory_rtx
0x9e9233 transcode_memory_rtx
0x9e9233 rl78_alloc_physical_registers_ro1
0x9e9233 rl78_alloc_physical_registers
0x9e9ab4 rl78_reorg
0x9e9ab4 devirt_pass
0x9e9ab4 execute
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <URL:https://gcc-renesas.com/> for instructions.



Open Source Tools Support commented