Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread David Brown
From: Stu Bell <s...@dabells.com> Date: 10/02/2017 03:58 (GMT+01:00) To: David Brown <da...@westcontrol.com>, Bob Paddock <graceindustr...@gmail.com>, avr-gcc-list@nongnu.org Subject: Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code" I hate to

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread Stu Bell
I hate to stick my nose in this after years away from the list, but... David is right about the problems with atomic functions in C. The good news is that there /is/ another solution: Use assembly language. That does not solve the problem within the domain of C, but it /does/ solve the problem

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread Marcin Godlewski
David, Thanks for pointing out the right place to submit the bug report. I have submitted one here: https://savannah.nongnu.org/bugs/index.php?50270 Best regards, Marcin Godlewski W dniu 2017-02-09 15:14:11 użytkownik David Brown napisał: > You could file this as a bug

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread Bob Paddock
On Thu, Feb 9, 2017 at 1:13 PM, David Brown wrote: > Note also that it is only control > of the memory access that is needed for code correctness - moving > instruction execution affects timing, but not the results. As I'm sure you are aware even if the code if

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread David Brown
The functions in atomic.h are correct, but their description is not quite accurate. The description says that inside an atomic block, the code cannot be interrupted. But as we have seen, /code/ can be moved inside and outside of an atomic block just as it can be moved around the "cli()"

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread Bob Paddock
Are the functions like macros in atomic.h correct? They attempt to deal properly with critical sections/code motion etc, in what this thread is discussing. http://www.nongnu.org/avr-libc/user-manual/group__util__atomic.html On Thu, Feb 9, 2017 at 9:14 AM, David Brown

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread David Brown
You could file this as a bug on the website: As far as I understand it, the documentation (both on the website and the Atmel documentation) is generated directly from the library code and comments - so this would be a change to the library

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2017-02-09 Thread Marcin Godlewski
Dear All, The site http://www.nongnu.org/avr-libc/user-manual/optimization.html#optim_code_reorder/optimization_1optim_code_reorder.html still contains buggy description of memory barriers in avr-gcc. As this site is popular among avr users I think it's really worth fixing. What is more the

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-10 Thread Marcin Godlewski
W dniu 2016-12-09 10:11:55 użytkownik David Brown napisał: > On 08/12/16 21:46, Georg-Johann Lay wrote: > > Marcin Godlewski schrieb: > >> Dear all, > >> > >> Thanks for the reply to David. However I'm not trying to find a > >> solution for the described issue. What I'm

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-09 Thread Marcin Godlewski
Please see my answer at the bottom. W dniu 2016-12-09 09:15:24 użytkownik David Brown napisał: > On 08/12/16 21:55, Marcin Godlewski wrote: > > > > > > W dniu 2016-12-08 21:46:40 użytkownik Georg-Johann Lay > > napisał: > >> Marcin Godlewski schrieb: >

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-09 Thread David Brown
On 08/12/16 21:46, Georg-Johann Lay wrote: > Marcin Godlewski schrieb: >> Dear all, >> >> Thanks for the reply to David. However I'm not trying to find a >> solution for the described issue. What I'm trying to say in this >> e-mail is that this part of Atmel documentation: >>

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-09 Thread David Brown
On 08/12/16 21:55, Marcin Godlewski wrote: > > > W dniu 2016-12-08 21:46:40 użytkownik Georg-Johann Lay > napisał: >> Marcin Godlewski schrieb: >>> Dear all, >>> >>> Thanks for the reply to David. However I'm not trying to find a solution >>> for the described issue. What I'm

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-08 Thread Georg-Johann Lay
Marcin Godlewski schrieb: Dear all, Thanks for the reply to David. However I'm not trying to find a solution for the described issue. What I'm trying to say in this e-mail is that this part of Atmel documentation:

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-08 Thread Marcin Godlewski
W dniu 2016-12-08 21:46:40 użytkownik Georg-Johann Lay napisał: > Marcin Godlewski schrieb: > > Dear all, > > > > Thanks for the reply to David. However I'm not trying to find a solution > > for the described issue. What I'm trying to say in this e-mail is that this > > part

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-08 Thread Marcin Godlewski
W dniu 2016-12-08 21:46:40 użytkownik Georg-Johann Lay napisał: > Marcin Godlewski schrieb: > > Dear all, > > > > Thanks for the reply to David. However I'm not trying to find a solution > > for the described issue. What I'm trying to say in this e-mail is that this > > part

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-08 Thread Marcin Godlewski
Dear all, Thanks for the reply to David. However I'm not trying to find a solution for the described issue. What I'm trying to say in this e-mail is that this part of Atmel documentation: http://www.atmel.com/webdoc/AVRLibcReferenceManual/optimization_1optim_code_reorder.html is innacurate

Re: [avr-gcc-list] Avr-libc-user-manual: "Problems with reordering code"

2016-12-08 Thread David Brown
On 07/12/16 00:42, Marcin Godlewski wrote: > Dear all, > > I'm writing with reference to the following paragraph in avr libc manual: > http://www.nongnu.org/avr-libc/user-manual/optimization.html#optim_code_reorder > > It is stated there: "However, memory barrier works well in ensuring that >