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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,40bf3d9b43d88cff X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-a.proxad.net!nnrp2-1.free.fr!not-for-mail From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: Access to fixed memory location References: <4750654d$0$13115$9b4e6d93@newsspool2.arcor-online.net> <87wsrz1kcu.fsf@willow.rfc1149.net> Date: Fri, 30 Nov 2007 23:22:06 +0100 Message-ID: <87oddb1ii9.fsf@willow.rfc1149.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:NxDKnqNZZepVXrQm6KXXUUyzrlw= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Leafnode-NNTP-Posting-Host: 2001:6f8:37a:2::2 Organization: Guest of ProXad - France NNTP-Posting-Date: 30 Nov 2007 23:25:20 MET NNTP-Posting-Host: 88.191.14.223 X-Trace: 1196461520 news-1.free.fr 19652 88.191.14.223:38029 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:18685 Date: 2007-11-30T23:25:20+01:00 List-Id: >>>>> "Sam" == Samuel Tardieu writes: >>>>> "Tomas" == Tomas Cernaj writes: Tomas> That's because the compiler can not assume that Y'Address will Tomas> not be changed. Sam> Well, no, that's not the reason (Y'Address is obviously static Sam> and constant). This is due to an unfortunate combination of three Sam> things: Sam> a) because of RM13.3(19), no optimization can be done on Y based Sam> on assumptions of no aliases Sam> b) to implement this clause, GCC marks the implicitly defined Sam> pointer type as volatile Sam> c) when this implicitly defined pointer type is marked as Sam> volatile, GCC generates code which does read+modify+write here at Sam> 3 separate operations rather than using an atomic one Sam> I think GNAT is overconservative concerning (b) as I do not think Sam> a volatile behaviour is mandated here, and that (c) could Sam> generate a better code but this is a separate issue from (b). I found a discussion about (b) dating from last September which explains that a lot of Ada code assumes that pragma Volatile is implicit and cannot be easily changed. So I asked about (c) on the GCC developers mailing-list, as it may be a missed optimization. Sam -- Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/