[Top][All Lists]

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

[avr-gcc-list] Pointers below address 32

From: Björn Haase
Subject: [avr-gcc-list] Pointers below address 32
Date: Tue, 10 May 2005 00:10:15 +0200
User-agent: KMail/1.7.1

Jörg Wunsch wrote:

>I'm not sure.  On the AVR, memory address 0 is an alias for r0.  Thus,
>by dereferencing a NULL pointer, you're touching whatever r0 (rather
>r0/r1) points to.  As this can touch anywhere (including memory-mapped
>IO devices), the behaviour is completely undefined, and you should
>probably avoid that kind of program anyway.

I never tried it, but is it actually really possible to access registers by 
using pointer expressions? If that's possible, one could possibly shorten the 
function prologues and epilogues considerably when optimizing for size. E.g. 
with a sequence like

        ldi r30,26
        ldi r31,0
        ldi r27,12 ; Save 12 registers starting from r(26-1) == r25
        ld __tmp_reg__,-z
        push __tmp_reg__
        dec r27
        brne loop



reply via email to

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