From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8339c7ac4436cbf,start X-Google-Attributes: gid103376,public From: "Jonas Nygren" Subject: for S'Storage_Size ... Date: 1997/02/16 Message-ID: <01bc1c0e$bf67c4e0$829d6482@joy.ericsson.se>#1/1 X-Deja-AN: 219158121 Organization: Ericsson Newsgroups: comp.lang.ada Date: 1997-02-16T00:00:00+00:00 List-Id: I have a program that uses 'for S'Storage_Size use XXX' and Gnat (3.09 Win95 and Solaris) generates Storage_Error before I have used up the storage that I have specified. It could be that it is a bug in Gnat or, perhaps more likely, a bug in my code. What is wrong with my code? task type Sub_Task is entry Dummy; end Sub_Task; type Sub_Task_Ref is access Sub_Task; for Sub_Task_Ref'Storage_Size use Max_Sub_Tasks * Sub_Task'Max_Size_In_Storage_Elements; ..... A_Sub_Task : Sub_Task_Ref; Task_Count : Integer := 0; begin loop exit when Task_Count = Max_Sub_Tasks; A_Sub_Task := new Sub_Task; Task_Count := Task_Count + 1; end loop; A Storage_Error will be generated when the fourth Sub_Task is allocated! If I change the 'for ... use ...' to add an extra 5 byte per Sub_Task object all works as expected. What could be wrong? /jonas