From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: MatthiasR Newsgroups: comp.lang.ada Subject: Re: Forcing GNAT to use 32-bit load/store instructions on ARM? Date: Sat, 26 Jul 2014 13:05:08 +0200 Organization: - Message-ID: References: <0e0b9ac2-e793-4cc5-8d8d-d3441ca28a58@googlegroups.com> <1j7b0m3yptffy$.1cztnkty8elrv$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Sat, 26 Jul 2014 11:11:56 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="5184a61264e63ac9a234e211ef48944d"; logging-data="27305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NH7+wYAaaBBsJPDB5cAEgzowANssgzjU=" User-Agent: KNode/4.7.2 Cancel-Lock: sha1:wsUmYAorWnloHDwGQYRd7fYUCvg= Xref: news.eternal-september.org comp.lang.ada:21241 Date: 2014-07-26T13:05:08+02:00 List-Id: Simon Clubley wrote: > On 2014-07-20, MatthiasR wrote: >> >> So, if a C compiler is AAPCS-compliant, volatile bitfields should have >> the desired behaviour. Whether a compiler is *really* AAPCS-compliant, is >> another question. A well-known open source C compiler had bugs in this >> area in several releases. Last year, attempts were made to repair it. I >> don't know the current status. >> > > That open source C compiler wouldn't be called gcc by any chance > would it ? :-) How did you guess that? ;-) > I did some experiments with using bitfields instead of bitmasks in > some bare metal ARM target C code a couple of years ago and ran into > the exact same problems as the OP's Ada code, with gcc's generated > code using ldrb instead of ldr. 'strict volatile bitfields' are good keywords to find some informations about the bugs in this area - and the recent attempts to fix them. > I haven't tried building a ARM cross compiler using the very latest > versions of gcc however. > > Simon. It looks like there are indeed some changes in the latest versions: In http://www.lpcware.com/content/forum/volatile-preventing-ldrb-byte-access someone complains that the compiler does *not* use ldrb on a volatile struct... Matthias