[Info-vax] yet another sys$qiow question

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Wed Aug 19 09:17:32 EDT 2015


On 2015-08-19, Johnny Billquist <bqt at softjar.se> wrote:
> On 2015-08-19 13:03, Stephen Hoffman wrote:
>> On 2015-08-19 02:46:48 +0000, John Reagan said:
>>
>>> You don't need memory barriers.  You do need volatile.  The IOSB is
>>> written behind your back.  volatile says we have to re-fetch.
>>
>> If that's the case, then there's a shedload of broken C code around
>> (including all of the SYS$EXAMPLES: IOSB references I can find; all of
>> those are not declared volatile, no volatile use in tcpip$examples:,
>> etc), and the OpenVMS and the C documentation and the OpenVMS and C
>> source code examples need updates (e.g.
>> <http://h71000.www7.hp.com/commercial/c/docs/5492profile_016.html>), and
>> a release note in the C compiler to flag all this stuff.
>
> What John said is correct.
> However, the code is not really totally broken. But it might be taking 
> longer to notice changes to the IOSB than it needed to.

Actually, potentially yes it is broken (depending on the optimisation
level in use.)

It depends on what the optimiser does with an empty loop on a
non-volatile variable and whether it just removes that loop completely.

Although I don't write empty loops for non-volatile variables, gcc can
(silently) optimise out other chunks of code that it thinks will never
be reached or is otherwise redundant so I would have to consider the
possibility that LLVM will do the same as well and that in some
circumstances it might do it with empty non-volatile while loops as well.

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world



More information about the Info-vax mailing list