[Info-vax] yet another sys$qiow question
Johnny Billquist
bqt at softjar.se
Wed Aug 19 09:25:41 EDT 2015
On 2015-08-19 15:17, Simon Clubley wrote:
> 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.
Agreed. My point was that most code have various function calls also
happening, which will inadvertently save them. :-)
Johnny
More information about the Info-vax
mailing list