avr-libc-dev
[Top][All Lists]
Advanced

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

RE: [avr-libc-dev] bug in rand()/random()/do_rand()/do_random( )


From: Mikal Hart
Subject: RE: [avr-libc-dev] bug in rand()/random()/do_rand()/do_random( )
Date: Sun, 4 Jan 2009 23:46:56 -0600

I understand that avr-libc is compiled by avr-gcc and that a defective
avr-gcc could possibly lead to a flawed copy of the library binary -- at
least the stuff written in C like random().  But here's the thing.  When I
install my Arduino package for Windows, I get a precompiled copy of
avr-libc, so it (presumably) doesn't matter that the package also contains
the bad compiler -- and in fact it does include the "bad" 4.3.0 version --
I'm still getting the "good" library.  This is just speculation here, but
I'm guessing that that means the Windows avr-libc must have been compiled
with a different compiler (4.3.2?) than the one distributed alongside it
(4.3.0) in the Arduino package.

In Linux-land, the paradigm is different.  Unlike Windows, the Arduino Linux
package doesn't supply either avr-gcc or avr-libc.  Instead, it requires the
user to procure these from "elsewhere", and this leads to the problem we
have been discussing.  Perhaps we need to change this to match Windows for
consistency's sake if nothing else.

Many thanks again for your replies and clear explanation.

Mikal



-----Original Message-----
From: Weddington, Eric [mailto:address@hidden 
Sent: Sunday, January 04, 2009 10:01 PM
To: Mikal Hart; Joerg Wunsch; address@hidden
Subject: RE: [avr-libc-dev] bug in rand()/random()/do_rand()/do_random( )

 

> -----Original Message-----
> From: Mikal Hart [mailto:address@hidden 
> Sent: Sunday, January 04, 2009 8:38 PM
> To: Weddington, Eric; 'Joerg Wunsch'; address@hidden
> Subject: RE: [avr-libc-dev] bug in 
> rand()/random()/do_rand()/do_random( )
> 
> > So far the evidence that you present points somehow to a 
> problem with
> 4.3.0, since this user said it works with 4.3.2. There are 
> known problems
> with 4.3.0 (for the AVR target) so I'm not totally surprised 
> that 4.3.2
> would fix it.
> 
> The only thing that makes me uneasy is that I don't see 
> exactly where the
> defective compiler comes into play.

Avr-libc is compiled with avr-gcc. The random functions in avr-libc are
written in C, hence the generated code is dependent on the avr-gcc compiler.
Avr-gcc 4.3.0 has code generation problems that are known. Avr-gcc 4.3.2
fixes those code generation problems. So it is a matter of what version of
avr-gcc was used to compile avr-libc.

Is that any clearer?





reply via email to

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