avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] miscompilation: save/restore of clobbered registers


From: Mudiaga Obada
Subject: Re: [avr-gcc-list] miscompilation: save/restore of clobbered registers
Date: Fri, 15 Jul 2005 23:15:09 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511

If r18 and r19 get clobbered, it's a avr-gcc feature. r16 - r17 is
preserved. See the avr-libc FAQ about register usage for more Info.

Jeyasankar Kottalam wrote:
> Hello,
> 
> With GCC 3.4.4 and 4.0.0 the following code is miscompiled; registers that the
> function modifies are not saved and restored when entering/leaving the
> function. We worked around the issue by adding explicit pushes and pops of
> registers r16 through r19 in our code.
> 
> typedef unsigned char u1;
> typedef unsigned long u4;
> 
> u4 sram_read_u4( u1 *ptr )
> {
>     return (((u4) *ptr) << 24)
>          | (((u4) *(ptr + 1)) << 16)
>          | (((u4) *(ptr + 2)) << 8)
>          | (((u4) *(ptr + 3)));
> }
> 




reply via email to

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