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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c550113251b19a6,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!not-for-mail From: Dennis Hoppe Newsgroups: comp.lang.ada Subject: Error: "could not understand bounds information on packed array" Date: Fri, 29 May 2009 02:55:23 +0200 Organization: Aioe.org NNTP Server Message-ID: NNTP-Posting-Host: HnPZBZ7DCuaTFargMPB8CQ.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.7.9 Cancel-Lock: sha1:c7pFLYv0Lww1BR8mniIRM4qZAro= User-Agent: Postbox 1.0b12 (Macintosh/2009051120) Xref: g2news2.google.com comp.lang.ada:6094 Date: 2009-05-29T02:55:23+02:00 List-Id: Hi, I am getting the following error message while executing my program: Execution terminated by unhandled exception Exception name: STORAGE_ERROR Message: stack overflow By use of gdb, I am getting some more useful information like Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3fffd0 0x0000000100027cde in my_procedure (input_a=warning: could not understand bounds information on packed array can't unpack array , input_b=warning: could not understand bounds information on packed array can't unpack array , input_c=can't unpack array , input_d=can't unpack array , input_e=0, output=) at my_package.adb:143 143 procedure myprocedure (input_a : in Bit_Field; I am using the following data types ... type Word is mod 2**64; for Word'Size use 64; pragma Volatile(Word); type Bit is new Natural range 0 .. 1; type Bit_Number is new Natural range 0 .. Word'Size - 1; type Bit_Field is array (Bit_Number) of Boolean; for Bit_Field'Component_Size use 1; ... and conversions ... function To_Bit_Field is new Ada.Unchecked_Conversion (Source => Word, Target => Bit_Field); function To_Word is new Ada.Unchecked_Conversion (Source => Bit_Field, Target => Word); Snippet: procedure my_procedure (input_a : in Bit_Field; input_b : in Bit_Field; input_c : in out Bit_Field; input_d : in out Bit_Field; index : in Natural; output : in out Word_Vector.Vector) is begin if index = Bit_Field'Length then Word_Vector.Append (output, To_Word(input_c)); else -- do something -- recursive call my_procedure(input_a, input_b, input_c, input_d, index+1, output); end if; end my_procedure; Currently, I am appending exactly eight elements to the vector. So, no Storage_Error could be raised based on too much elements. The procedure, which causes the error is recursive. A new Word will be constructed bitwise and in the end, the Word will be appended to a vector. First, I thought, the error may be raised due to the unchecked conversions (cf. "can't unpack array"). However, I am using the unchecked conversion just once in the termination clause. Uncommenting the conversion does not help. Then, I am stumbled upon "EXC_BAD_ACCESS, Could not access memory". Additionally, the error message differs from time to time (if I compile with or without optimization, with or without -fstack-check): Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3fffe0 0x00007fff82d91b28 in szone_malloc () (gdb) backtrace #0 0x00007fff82d91b28 in szone_malloc () #1 0x00007fff82d91aef in malloc_zone_malloc () #2 0x00007fff82d91a80 in malloc () #3 0x000000010006da5f in __gnat_malloc () #4 0x0000000100025f48 in word_vector.insert (container=, before=0, new_item=16, count=) at a-convec.adb:829 #5 0x0000000100026488 in word_vector.append (container=, new_item=9223654062804208200, count=1598043600) at a-convec.adb:316 This may be caused in the termination clause, where I try to append the new Word to a vector. It is interesting, that call #5 and #4 has another value for "new_item", although insert is called in the body of append. At the moment, I am wondering, if my computer has some memory issues. I know, the problem is hard to understand. I would like to provide a minimal code snippet to demonstrate the failure, but the whole program is very complex. I tried to take the parameters given by the debugger -- recovered by means of backtracing -- directly as input to the procedure. But no error occurs at all, if I call the problematic procedure solely. Best regards, Dennis Hoppe