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

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

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


From: Jeyasankar Kottalam
Subject: [avr-gcc-list] miscompilation: save/restore of clobbered registers
Date: Sun, 10 Jul 2005 00:12:33 -0700
User-agent: Internet Messaging Program (IMP) H3 (4.0)

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)));
}

I've attached the output of GCC 4.0.0 with "-mmcu=atmega128", but the problem is
 present in 3.4.4 as well, and also present with or without optimization.

Thanks,
-Jey Kottalam





reply via email to

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