Hi SDCC developers,

I've written some code for the PIC18F2620 that uses function pointer
arrays. Whilst mucking around doing some debugging, I found that the
pic16 port of SDCC crashes when attempting to handle an array of const
pointers that is declared without an initialiser. As an example, for
file "badcode.c" containing:

void (* const func_ptrs[])();

Compiling with "sdcc -mpic16 -c badcode.c" gives:

badcode.c:1: error 66: attempt to allocate variable of unknown size
'func_ptrs'
badcode.c:2: error 9: FATAL Compiler Internal Error in file 'glue.c'
line number '1398' : 0 
Contact Author with source code

I was thinking of putting a "continue" after line 1278 of glue.c to skip
to the next symbol after printing the error, rather than continuing to
the "assert(0)" at 1398. However I suspect this problem should be
getting picked up earlier. Doing something like:

const int arr[];

Causes the error:

badcode.c:1: error 99: variable 'arr' declared in code space must have
initialiser

Generated at line 1789 of SDCCsymt.c. Should this same error be raised
for a function pointer array in code space with no initialiser? What is
the best way to fix this?

Regards,

Patrick

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to