[U-Boot] WARNING: in gcc 4.5.0 and 4.5.1 volatile is ignored

Hello,
because I've recently seen some other places where volatile is used to access registers without using read?() or write?() and many people seem to start using 4.5.1, I want to post this warning using a descriptive subject.
The keyword volatile might not have any effect when reading when gcc 4.5.0 or 4.5.1 is used.
The appropriate bug seems to be that one:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45052
You might either change such code to use readb(), readw() or readl(), or you have to use either an older version of gcc or a version >= 4.5.2 (it is fixed in 4.5.2).
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
Regards,
Alexander

Dear Alexander Holler,
In message 4D3AD19B.6030102@ahsoftware.de you wrote:
because I've recently seen some other places where volatile is used to access registers without using read?() or write?() and many people seem to start using 4.5.1, I want to post this warning using a descriptive subject.
The keyword volatile might not have any effect when reading when gcc 4.5.0 or 4.5.1 is used.
Actuelly this warning should eventually be extended to carefully check results when using any of the currently available 4.5.x versions of GCC.
The appropriate bug seems to be that one:
This is probably only one part of the problem. Thereare a number of other bugs in thes ecompiler versions, for example this one:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392
Unfortunately there appears to be little interest within the GCC folks to fix porolems that affect only such lunatic fringe groups as the embedded folks, so I don't expect to see fixes any time soon. Even bigger projects like the Linux Foundation driven Poky (resp. Yocto project) capitulated and stopped using -Os, see for example here: http://thread.gmane.org/gmane.linux.embedded.poky/2311/focus=2565
Yes, "-Os" is default setting for U-Boot - changing it to (for example) -O2 will generate significantly larger code and even break a number of boards.
It appears there are a number of other issues with GCC 4.5.x that affect us. If you are using any such tool chain, and see strange results or unexpected breakages, it is probably a very good idea to try another (older, working) tool chain first, before spending any tme on debugging.
You might either change such code to use readb(), readw() or readl(), or you have to use either an older version of gcc or a version >= 4.5.2 (it is fixed in 4.5.2).
We will take care to provide working (at least with most of the compiler versions) I/O accessors (including sufficient memory barriers), and all code that uses the old volatile pointer approach to access device registers should be converted to use proper I/O acessors.
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
Thanks for raising this issue again.
Best regards,
Wolfgang Denk

On 22.01.2011 13:46, Alexander Holler wrote:
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
What's about pulling it sooner than later into master, then?
And would it be worth to think about applying this to 2010.12 and creating a 2010.12.1?
Best regards
Dirk

Hi Dirk,
Le 22/01/2011 18:40, Dirk Behme a écrit :
On 22.01.2011 13:46, Alexander Holler wrote:
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
What's about pulling it sooner than later into master, then?
I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.
Amicalement,

Dear Albert ARIBAUD,
In message 4D3B1C0C.4040805@free.fr you wrote:
Le 22/01/2011 18:40, Dirk Behme a =E9crit :
On 22.01.2011 13:46, Alexander Holler wrote:
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
What's about pulling it sooner than later into master, then?
I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.
Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?
Best regards,
Wolfgang Denk

Le 22/01/2011 20:30, Wolfgang Denk a écrit :
Dear Albert ARIBAUD,
In message4D3B1C0C.4040805@free.fr you wrote:
Le 22/01/2011 18:40, Dirk Behme a =E9crit :
On 22.01.2011 13:46, Alexander Holler wrote:
A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):
http://lists.denx.de/pipermail/u-boot/2011-January/084885.html
What's about pulling it sooner than later into master, then?
I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.
Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?
I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.
Best regards,
Wolfgang Denk
Amicalement,

Dear Albert ARIBAUD,
In message 4D3B3CB9.2060804@free.fr you wrote:
Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?
I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.
As soon as you send the pull-request for ARM (when will that be, btw?) I will also cherry-pick that commit into a .1 stable branch.
Best regards,
Wolfgang Denk

Le 24/01/2011 14:03, Wolfgang Denk a écrit :
Dear Albert ARIBAUD,
In message4D3B3CB9.2060804@free.fr you wrote:
Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?
I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.
As soon as you send the pull-request for ARM (when will that be, btw?) I will also cherry-pick that commit into a .1 stable branch.
Ok. I am going through my patchwork backlog; I might be done tomorrow evening, but more probably the day after.
Best regards,
Wolfgang Denk
Amicalement,
participants (4)
-
Albert ARIBAUD
-
Alexander Holler
-
Dirk Behme
-
Wolfgang Denk