!standard 13.11.6(11/3) 14-11-13 AI05-0134-1/02 !class presentation 14-10-09 !status Corrigendum 2015 14-11-13 !status ARG Approved 7-0-1 14-10-18 !status work item 14-10-09 !status received 14-08-09 !priority Low !difficulty Easy !qualifier Clarification !subject Error in Storage Pool example !summary The storage component in the example of 13.11.6(11/3) can't subtract 1. !question The component Storage in 13.11.6(11/3) is declared thusly: Storage : Storage_Array (0 .. Pool_Size-1); This is illegal by 3.8(12/2), as the discriminant does not stand alone. Should this be fixed? (Yes.) !recommendation (See Summary.) !wording Modify 13.11.6(11/3): Storage : Storage_Array (0 .. Pool_Size[-1]); [Editor's Note: This wastes one storage unit, but that's a lot easier than trying to correct the rest of the example to use a 1-based Storage array.] !discussion The subtraction is indeed illegal. We just removed it, as doing so only wastes a single storage unit (unlikely to be significant). Alternatively, we could have rewritten the pool to use a 1-based component. But that would probably introduce other bugs (particular in the alignment calculation, which was wrong in a previous version). Thus we didn't do that. !corrigendum 13.11.6(11/3) @drepl @xcode< @b Mark_Release_Pool_Type (Pool_Size : Storage_Count) @b Subpools.Root_Storage_Pool_With_Subpools @b Storage : Storage_Array (0 .. Pool_Size-1); Next_Allocation : Storage_Count := 0; Markers : Subpool_Array; Current_Pool : Subpool_Indexes := 1; @b;> @dby @xcode< @b Mark_Release_Pool_Type (Pool_Size : Storage_Count) @b Subpools.Root_Storage_Pool_With_Subpools @b Storage : Storage_Array (0 .. Pool_Size); Next_Allocation : Storage_Count := 0; Markers : Subpool_Array; Current_Pool : Subpool_Indexes := 1; @b;> !ASIS No changes needed. !ACATS test No test needed. !appendix !topic Error in Storage Subpool Example !reference Ada 2012 RM 13.11.6(11/3) !from Rodrigo Garcia 14-08-10 !keywords discriminant constraint !discussion One of the corrections applied to the subpool example in 13.11.6(11/3), as described in AI05-0298-1, causes a violation of 3.8(12/3), which specifies that a discriminant used to define the constraint of a component shall appear alone and not as part of a larger expression: Storage : Storage_Array (0 .. Pool_Size-1); Pool_Size appears indeed as part of a subtraction expression, making the component declaration illegal. **************************************************************** From: Rodrigo Garcia Sent: Tuesday, September 2, 2014 5:58 AM The topic that I thought new is already reported in AI12-0080-1 that can be found here: http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0080-1.txt Sorry for the inconvenience. Nevertheless, the corresponding paragraph 13.11.6(11/3) of the subpool example in the AARM of the future 202X standard does not mention this AI. Only paragraph 13.11.6(28/4) is modified. Therefore, as it is, the component declaration remains illegal. ****************************************************************