[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Incorrect code by gcc?
From: |
Ruud Vlaming |
Subject: |
Re: [avr-gcc-list] Incorrect code by gcc? |
Date: |
Thu, 3 Apr 2008 00:51:59 +0200 |
User-agent: |
KMail/1.9.1 |
On Thursday 03 April 2008 00:27, Andy H wrote:
> Not a bug
Very good spotting. Andy! Thank you!
Thats the reason i wanted it to post here before sending in a bug report.
Unfortunately i already did so, so i marked the bug as INVALID now.
The bugnumber was 35807
> According to the sources you posted,
> privQueuRequestBody
> void privQueuRequestBody(uint8_t uiSlot, int8_t siFreeFilling, uint16_t
> uiTicksToWait) __attribute__ ( ( naked ) );
>
> The relevant part being "naked"
>
> That means gcc will omit prolog - which is where stack and frame pointer are
> setup.
> R28/29 is the frame pointer. What you see in assembler is gcc saving the
> register around a call.
> Depending on optimization, it may choose to do this rather than use a
> register (as the register would need to be saved on the stack).
>
> If you use naked, you must replace all of prolog/epilog by hand. (its normal
> use is for assembler only functions)
OK, naked is a "dangerous" attribute. I must use it for i do a context save
just before the
body function is called, but must preserve all registers so the function
parameters are
left alone.
Is there a way to prohibit the compiler to do so? In other words can i somehow
forbid
to make use of the frame pointer? -fomit-frame-pointer seems not to do the
trick.
Since i know on beforehand i will not return from privQueuRequestBody there is
no
need to save the stack or so.
Ideas?
Ruud.