[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: Patch Fix PR35013, PR27192

From: hutchinsonandy
Subject: Re: [avr-gcc-list] Re: Patch Fix PR35013, PR27192
Date: Wed, 16 Apr 2008 09:17:00 -0400

Indirect calls - ie simple function pointers are safe!

It is only when you try and do some arithmetic with them that there is potential problem. The only reason to use arithmetic is for ASM related manipulations. (but very useful!)

For example , (excuse syntax mistakes)

void foo(void) {}

(void * p1) (void);

p1 = &foo;  //NO PROBLEM
p2= foo +2 ; //BROKEN

p3 =foo; //OK
P3 +=2; // BROKEN - indeterminate

My patched FIXED p1,p2 - but not P3.

-----Original Message-----
From: Dmitry K. <address@hidden>
To: address@hidden
Sent: Wed, 16 Apr 2008 2:13 am
Subject: Re: [avr-gcc-list] Re: Patch Fix PR35013, PR27192

On Wednesday 16 April 2008 14:02, Andy H wrote:

A problem has come up trying to  fix  function pointer arthmetic bugs.

(It is difficult to understand all quickly.)
A question:  Is it safety to use common indirect call
of function with avr6 at present moment?  It is interesting,
as indirect call is used in Avr-libc's EEPROM functions now.

I have try a small program.  Seems, the result is wrong
(Binutils is 2.18, see avr-libc-dev discussion).


AVR-GCC-list mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]