[Info-vax] Volatile, was: Re: yet another sys$qiow question
John Reagan
xyzzy1959 at gmail.com
Thu Aug 20 12:03:09 EDT 2015
On Thursday, August 20, 2015 at 11:43:44 AM UTC-4, JF Mezei wrote:
> Say I set the IOSB to zeroes,
> call QIOW passing IOSB
> then check IOSB to make sure IO completed with success.
The service clears the IOSB for you.
>
> Would the compiler realise that QIOW could modify the IOSB and thus make
> sure that when I check the IOSB, it doesn't assume it is still set to 0s ?
No, since you passed it to $QIOW, we know it can be modified by the service.
> I learned that whenever I need to use the debugger, to always
> CC/nooptimize , but never really considered cases where an AST
> modifying a variable (or the driver itself) would not result in my code
> seeing the updated value.
Then you are lucky. Even with /NOOPT, machines like Alpha and Itanium need multiple instructions to load/increment/store. If your AST occurs in that sequence which also increments the shared variable, you can miss an increment.
More information about the Info-vax
mailing list