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,FREEMAIL_FROM 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!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!hwmnpeer03.ams!news.highwinds-media.com!transit5.hitnews.eu!npeer.de.kpn-eurorings.net!npeer-ng1.kpn.DE!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: Tomas Cernaj Subject: Re: Access to fixed memory location Newsgroups: comp.lang.ada References: <4750654d$0$13115$9b4e6d93@newsspool2.arcor-online.net> <87wsrz1kcu.fsf@willow.rfc1149.net> User-Agent: Pan/0.129 (Benson & Hedges Moscow Gold) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 02 Dec 2007 22:00:16 GMT Message-ID: <47532af0$0$13112$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Dec 2007 23:00:16 CET NNTP-Posting-Host: adeb7be0.newsspool2.arcor-online.net X-Trace: DXC=][f;gn>DRN;Tia]Ho99G50A9EHlD;3Yc24Fo<]lROoR14nDHegD_]R5^al3JB@BcA?kd=52>SHf;2g=1B;EnI3J4=U=45GPcN38U>Y;Xoga`i1 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:18696 Date: 2007-12-02T23:00:16+01:00 List-Id: Thank you for your quick response. You've helped me a lot to sort things out. Actually I think there's two problems at hand: 1) the read/modify/write access 2) the indirect access ad 1): As explained by Richard Kenner, the C construct "y |= 32" is by definition equivalent to "y = y | 32", so R/M/W is perfectly OK. However, writing "Y (5) := True" IMO means that we only want to set the corresponding bit, no matter what the rest of the byte/word etc. looks like. I've tried this using a (volatile) bit field in C, and here again gcc generates a R/M/W access. (compiler problem...?) ad 2): I'm not quite sure if I've understood the concept of aliased types you mentioned in (a)... :-| Anyways, I modified the example in my first post to include "pragma Volatile (T_Type);". Here's what gcc generates: movzbl 50, %eax ; X (4) := True orl $16, %eax movb %al, 50 movq testpkg__y(%rip), %rdx ; Y (5) := True movzbl (%rdx), %eax orl $32, %eax movb %al, (%rdx) So X is accessed directly while Y is accessed indirectly. That's why I thought it had something to do with Y'Address not being constant... (I mean that whenever one uses the package where Y is declared one can still change the value of Y'Address). Am I missing a point? Thanks, Tomas