> -----Original Message-----
> From: 
> [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> org] On Behalf Of Wouter van Gulik
> Sent: Saturday, January 19, 2008 8:16 AM
> To: [email protected]
> Subject: [avr-gcc-list] How to get low byte off a function address?
> 
> Dear list,
> 
> How do I do this:
> 
> main.c
> =============================================
> void foo(void) {
> }
> 
> char table[2] = {
>     (foo),     
>     (foo),     
> };
> 
> int main(int argc, char* argv[]) 
> {
>       int adr = table[argc]+0x3F00;

FYI, there is a known bug in AVR GCC 4.x about adding an offset to a
function pointer and doing and indirect call:
GCC bug #27192
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27192>

Dr. John Regehr (CCed) is the one that found the bug.

IIRC, 3.4.x did not have this problem.

Eric Weddington


_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to