[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] snprintf bug ?
From: |
Russell Strong |
Subject: |
Re: [avr-libc-dev] snprintf bug ? |
Date: |
Thu, 13 Oct 2005 20:49:48 +1000 |
Hi,
I'm using an ATmega128, avr-size below
address@hidden navigation]$ avr-size navigation.elf
text data bss dec hex filename
3858 886 427 5171 1433 navigation.elf
address@hidden navigation]$
On Thu, 2005-10-13 at 10:34 +0200, Bernard Fouché wrote:
> Russell Strong wrote:
>
> >Hi,
> >
> >I may have found a bug, I'm not sure if it would be with avr-libc or
> >gcc. I'm using gcc-4.0.1, binutils-2.16.1 avr-libc-1.2.5.
> >
> >The problem is with the following function and snprintf, if heading_tmp
> >is declared static it all works. If it is not declared static, snprintf
> >puts garbage into heading_tmp ( lot of 0xb1 ).
> >
> >Am I doing something illegal? Do snprintf pointers need to be static? I
> >couldn't find any thing like that in the Docs.
> >
> >
> >
> The difference here between having 'static' or not for heading_tmp[] is,
> without 'static' to use the stack for memory storage, or, with 'static'
> to use the .bss segment (global variable). So that's RAM anyway and
> snprintf() does not care about what bunch of ram you use.
>
> Usually the problem that you describe appears if:
>
> - the memory used in the stack is referenced after that the function has
> returned. It is not the case here.
> - the stack grew too much and something else scrapped it or the stack
> scrapped something else (some global variable just after the maximum
> allowable stack). Interrupt routines called while your function is being
> processed will grow the stack also. Obviously you have interrupt
> routines since you use cli()/sei().
> - you ran in a yet unknown (and unlikely) compiler bug.
>
> Can you show the result of 'avr-size your_program.elf' and tell us what
> target you are using?
>
> Bernard
>
>
signature.asc
Description: This is a digitally signed message part
- [avr-libc-dev] Re: snprintf bug ?, (continued)
- [avr-libc-dev] Re: snprintf bug ?, Joerg Wunsch, 2005/10/13
- Re: [avr-libc-dev] Re: snprintf bug ?, Russell Strong, 2005/10/13
- Re: [avr-libc-dev] Re: snprintf bug ?, Dmitry K., 2005/10/13
- Re: [avr-libc-dev] Re: snprintf bug ?, Björn Haase, 2005/10/14
- Re: [avr-libc-dev] Re: snprintf bug ?, Marek Michalkiewicz, 2005/10/14
- RE: [avr-libc-dev] Re: snprintf bug ?, Darcy Watkins, 2005/10/14
- Re: [avr-libc-dev] Re: snprintf bug ?, Joerg Wunsch, 2005/10/15
- Re: [avr-libc-dev] Re: snprintf bug ?, Joerg Wunsch, 2005/10/14
- Re: [avr-libc-dev] Re: snprintf bug ?, Russell Strong, 2005/10/14
Re: [avr-libc-dev] snprintf bug ?, Bernard Fouché, 2005/10/13
- Re: [avr-libc-dev] snprintf bug ?,
Russell Strong <=