J3/14-168r1 To: J3 Subject: F2015: allow non-default kinds in arguments to intrinsics From: Stan Whitlock Date: 2014 June 18 Ref: 14-007r1 0. Straw Vote There have been questions raised about the edits affecting [381:30] 13.7.136 RANDOM_SEED (SIZE, PUT, GET). Here is the e-mail discussion: On Jun 9, 2014, 6:25 AM, Robert Corbett wrote: Would RANDOM_SEED(SIZE=K) return the number of default integers the processor uses to hold the value of the seed? On Jun 9, 2014, 8:41 AM, Bill Long said: Good question. The options that come to mind first are either default integer, or integer of the same kind as KIND(K). But something needs to be said, since the meaning of N is otherwise ambiguous. It would be convenient to have it be KIND(K) integers for the arrays since one assumes that is how you would be declaring the arrays for PUT and GET. And that avoids the current silliness of splitting the seeds in half and storing each half in a default integer. Which raises another question of whether we should also allow scalar arguments for GET and PUT. Similar to Bob's original question: What happens if the user calls RANDOM_SEED with a GET array of kind=4, later copies the values to another array of kind=8, and then calls again with the new array as the PUT argument? Or what happens if the user calls with kind=2 or kind=1 integer arrays for GET/PUT? A careful implementation could work around all these issues, but is it worth the benefit to the user? On Jun 9, 2014, 9:23 AM, Steve Lionel said: RANDOM_SEED(SIZE=K) would return the number of integers of kind K. RANDOM_SEED should not accept scalars, that's somewhat non-portable unless we're going to redefine the arguments as being assumed-rank. It's also a needless complication in use. As for changing the kinds, I assume that RANDOM_SEED would just interpret the storage in whatever kind it really wants. It's not as if the user has visibility into the internal algorithm used and can carefully pick the seeds. There is no change proposed here to make RANDOM_SEED accept scalar arguments. Note that the current definition of RANDOM_SEED does not specify the KIND of the integers that the processor uses to hold the value of the seed. The proposed straw votes are: SV #1 1) keep the proposed edits below for [381:30] 13.7.136 RANDOM_SEED or 2) remove the proposed edits below for [381:30] 13.7.136 RANDOM_SEED or 3) undecided SV #2 1) modify RANDOM_SEED to specify that the SIZE argument returns the number N of integers of KIND (SIZE) that the processor uses to hold the value of the seed The edit to 14-007r1 is: [381:35] after "integer", insert "of KIND (SIZE)" or 2) make no change to RANDOM_SEED to specify the KIND of the integers that the processor uses to hold the value of the seed or 3) undecided 1. Introduction =============== In Fortran 2008 we extended the allowed kinds for OPEN and INQUIRE specifiers from default kind to any kind. See 14-007r1 [209] OPEN (RECL=) or [237] INQUIRE (NEXTREC=). F2008 did not change default character usage in these specifiers. Several of the intrinsic procedures [chapter 13] and the IEEE intrinsic module procedures [chapter 14] require that their arguments be of default kind. This is unnecessary. The proposal is to extend these arguments to any kind. There is no change proposed for default character arguments or for default kinds for function results. 2. Proposal for 2015 work plan ============================== Extend the kinds for arguments in certain intrinsic and intrinsic module procedures to allow any kinds, not just default kinds. The procedures and their arguments that are affected are: [342:17] 13.7.44 DATE_AND_TIME (, , , VALUES) [347:21] 13.7.57 EXECUTE_COMMAND_LINE ( , WAIT, EXITSTAT, CMDSTAT, ) [351:7 ] 13.7.65 GET_COMMAND ( , LENGTH, STATUS) [351:24] 13.7.66 GET_COMMAND_ARGUMENT (NUMBER , , LENGTH, STATUS) [352:27] 13.7.67 GET_ENVIRONMENT_VARIABLE ( , , LENGTH, STATUS, ) [381:30] 13.7.136 RANDOM_SEED (SIZE, PUT, GET) [395:1 ] 13.7.167 THIS_IMAGE ( , DIM) [414:1 ] 14.11.4 IEEE_GET_FLAG ( , FLAG_VALUE) [414:12] 14.11.5 IEEE_GET_HALTING MODE ( , HALTING) [415:19] 14.11.8 IEEE_GET_UNDERFLOW_MODE (GRADUAL) [419:19] 14.11.19 IEEE_SET_FLAG ( , FLAG_VALUE) [419:31] 14.11.20 IEEE_SET_HALTING_MODE ( , HALTING) [421:1 ] 14.11.23 IEEE_SET_UNDERFLOW_MODE (GRADUAL) 3. Draft Edits to 14-007r1 ========================== In 13.7.44 DATE_AND_TIME: argument VALUES: [342:33] delete "default" In 13.7.57 EXECUTE_COMMAND_LINE: argument WAIT: [347:27] delete "default" argument EXITSTAT: [347:30] delete "default" argument CMDSTAT: [348:2 ] delete "default" In 13.7.65 GET_COMMAND: argument LENGTH: [351:14] delete "default" argument STATUS: [351:20] delete "default" In 13.7.66 GET_COMMAND_ARGUMENT: argument NUMBER: [351:28] delete "default" argument LENGTH: [352:4 ] delete "default" argument STATUS: [352:10] delete "default" In 13.7.67 GET_ENVIRONMENT_VARIABLE: argument LENGTH: [352:37] delete "default" argument STATUS: [352:40] delete "default" In 13.7.136 RANDOM_SEED: argument SIZE: [381:34] delete "default" argument PUT: [382:1 ] delete "default" argument GET: [382:4 ] delete "default" In 13.7.167 THIS_IMAGE: argument DIM: [395:6] delete "default" In 14.11.4 IEEE_GET_FLAG: argument FLAG_VALUE: [414:6] delete "default" In 14.11.5 IEEE_GET_HALTING MODE: argument HALTING: [414:19] delete "default" In 14.11.8 IEEE_GET_UNDERFLOW_MODE: argument GRADUAL: [415:22] delete "default" In 14.11.19 IEEE_SET_FLAG: argument FLAG_VALUE: [419:27] delete "default" In 14.11.20 IEEE_SET_HALTING_MODE: argument HALTING: [419:38] delete "default" In 14.11.23 IEEE_SET_UNDERFLOW_MODE: argument GRADUAL: [421:4] delete "default"