Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
13.1 when initializing with address of volatile variable
#4
Yes, you are correct. We had misparsed the macro expansion for &REG2.bar when writing the response.

Our position is that taking the address of REG2.bar is not a volatile access and there is no violation of rule 13.1.

The reason for this is as follows. REG2 expands to an lvalue. According to C99 6.3.2.1(2) an lvalue, appearing as the left operand of the "." operator, is not converted to a value (i.e. there is no memory access). According to C99 6.5.2.3(2), the result of the "." operator is an lvalue. Then according to C99 6.5.3.2(3) the "address of"(&) operator converts its operand to its address and again, no memory access is involved.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)