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: 103376,75d2eb9e2e52a8c5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k15g2000pri.googlegroups.com!not-for-mail From: Rod Kay Newsgroups: comp.lang.ada Subject: Re: Problem where a function is invoked once but called twice (when invocation is within an allocator). Date: Thu, 5 May 2011 17:49:56 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <87r58dxeia.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: 110.174.207.98 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1304642997 17311 127.0.0.1 (6 May 2011 00:49:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 May 2011 00:49:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k15g2000pri.googlegroups.com; posting-host=110.174.207.98; posting-account=Uqu8JwoAAADsGt83KB06QWEVsML1fPO7 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.04 Chromium/11.0.696.57 Chrome/11.0.696.57 Safari/534.24,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19176 Date: 2011-05-05T17:49:56-07:00 List-Id: On May 6, 3:07=A0am, Florian Weimer wrote: > > Could you show the -gnatG output as well? Source recreated from tree for Tester (body) -------------------------------------------- with media; with media.media__video; with opengl; with ada.ada__tags; with system.system__secondary_stack; procedure tester is M13b : system__secondary_stack__mark_id :=3D $system__secondary_stack__ss_mark; procedure tester___clean is begin $system__secondary_stack__ss_release (M13b); return; end tester___clean; begin the_movie : media.media__video.media__video__view :=3D media. media__video.media__video__new_video__2 ("xyz.avi"); [constraint_error when the_movie =3D null "access check failed"] -- Case 1 begins here ... type tester__A3b is access all opengl__image; R4b : constant tester__A3b :=3D media__video__next_frame (the_movie, selfL =3D> 0)'reference; subtype tester__Tcase_1S is opengl__image (R4b.all'first(1) .. R4b.all' last(1), R4b.all'first(2) .. R4b.all'last(2)); [constraint_error when R4b.all'last(2) >=3D R4b.all'first(2) and then (R4b.all'first(2) < 0 or else R4b.all'last(2) > 65535) "range check failed"] [constraint_error when R4b.all'last(1) >=3D R4b.all'first(1) and then (R4b.all'first(1) < 0 or else R4b.all'last(1) > 65535) "range check failed"] case_1 : opengl__image (R4b.all'first(1) .. R4b.all'last(1), R4b.all' first(2) .. R4b.all'last(2)) :=3D R4b.all; -- Case 2 begins here ... type tester__A10b is access all opengl__image; R11b : constant tester__A10b :=3D (media__video__next_frame (the_movie, selfL =3D> 0))'reference; subtype tester__A9b is opengl__image ((R11b.all)'first(1) .. (R11b.all)' last(1), (R11b.all)'first(2) .. (R11b.all)'last(2)); [constraint_error when (R11b.all)'last(2) >=3D (R11b.all)'first(2) and then ((R11b.all)' first(2) < 0 or else (R11b.all)'last(2) > 65535) "range check failed"] [constraint_error when (R11b.all)'last(1) >=3D (R11b.all)'first(1) and then ((R11b.all)' first(1) < 0 or else (R11b.all)'last(1) > 65535) "range check failed"] case_2 : access opengl.opengl__image :=3D new opengl.opengl__image'( tester__A9b?((media__video__next_frame (the_movie, selfL =3D> 0)))); [subtype tester__T6b is access opengl__image] reference tester__T6b null; return; at end tester___clean; end tester; For Case_2, it appears the 1st call to next_Frame is used purely to get the bounds of the returned array. The bounds are then used to define 'tester__A9b' which is a subtype of opengl.Image of the correct size. 'tester__A9b' is then used to convert the result of the 2nd call to next_Frame, during allocation.