J3/17-104 To: J3 From: Bill Long Subject: Integration of assumed-rank and C_SIZEOF Date: 2017 January 03 Discussion: ----------- Paper 16-277r1 adds C_SIZEOF() to the list of intrinsics that allow an assumed-rank argument. This was motivated by the fact that C_SIZEOF() can be computed from the result of SIZE() with the same argument and SIZE() now allows an assumed-rank argument. Nick Maclaren pointed out that for the case where an assumed-rank argument represents an assumed-size array the result value is not specified in the description of C_SIZEOF(). Indeed, C_SIZEOF() specifically does not allow an assumed-size argument. SIZE() does specify the result for case of an assumed-rank argument that is associated with an assumed-size variable. However, that result is negative. Relying on that special case would lead to a negative result for C_SIZEOF() if it were computed by a product where SIZE() is an operand. A negative value for C_SIZEOF() is incompatible with its intended semantics of simulating sizeof() in C. The Argument text for C_SIZEOF() needs to be modified to say that a dummy argument that is assumed-rank cannot be argument-associated with an assume-size array. Note that this limitation is already stated in 17-007 in the Introduction, paragraph 2, and the end of the item Features previously described in ISO/IEC TS 29113:2012. Edits to 17-007: ------------------ [488:24] In 18.2.3.7 C_SIZEOF ( ), paragraph 3, "Argument" after "that is not an assumed-size array" insert " or an assumed-rank array that is associated with an assumed-size array".