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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!j23g2000yqc.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: Problem where a function is invoked once but called twice (when invocation is within an allocator). Date: Fri, 6 May 2011 16:41:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <87r58dxeia.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: 149.32.224.34 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1304725304 13255 127.0.0.1 (6 May 2011 23:41:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 May 2011 23:41:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j23g2000yqc.googlegroups.com; posting-host=149.32.224.34; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19177 Date: 2011-05-06T16:41:44-07:00 List-Id: On May 5, 5:49=A0pm, Rod Kay wrote: > 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 > =A0 =A0M13b : system__secondary_stack__mark_id :=3D > =A0 =A0 =A0$system__secondary_stack__ss_mark; > > =A0 =A0procedure tester___clean is > =A0 =A0begin > =A0 =A0 =A0 $system__secondary_stack__ss_release (M13b); > =A0 =A0 =A0 return; > =A0 =A0end tester___clean; > begin > =A0 =A0the_movie : media.media__video.media__video__view :=3D media. > =A0 =A0 =A0media__video.media__video__new_video__2 ("xyz.avi"); > =A0 =A0[constraint_error when > =A0 =A0 =A0the_movie =3D null > =A0 =A0 =A0"access check failed"] > > =A0 =A0-- Case 1 begins here ... > =A0 =A0type tester__A3b is access all opengl__image; > =A0 =A0R4b : constant tester__A3b :=3D media__video__next_frame (the_movi= e, > =A0 =A0 =A0selfL =3D> 0)'reference; > =A0 =A0subtype tester__Tcase_1S is opengl__image (R4b.all'first(1) .. > R4b.all' > =A0 =A0 =A0last(1), R4b.all'first(2) .. R4b.all'last(2)); > =A0 =A0[constraint_error when > =A0 =A0 =A0R4b.all'last(2) >=3D R4b.all'first(2) and then (R4b.all'first(= 2) < > =A0 =A0 =A0 =A00 or else R4b.all'last(2) > 65535) > =A0 =A0 =A0"range check failed"] > =A0 =A0[constraint_error when > =A0 =A0 =A0R4b.all'last(1) >=3D R4b.all'first(1) and then (R4b.all'first(= 1) < > =A0 =A0 =A0 =A00 or else R4b.all'last(1) > 65535) > =A0 =A0 =A0"range check failed"] > =A0 =A0case_1 : opengl__image (R4b.all'first(1) .. R4b.all'last(1), > R4b.all' > =A0 =A0 =A0first(2) .. R4b.all'last(2)) :=3D R4b.all; > > =A0 =A0-- Case 2 begins here ... > =A0 =A0type tester__A10b is access all opengl__image; > =A0 =A0R11b : constant tester__A10b :=3D (media__video__next_frame > (the_movie, > =A0 =A0 =A0selfL =3D> 0))'reference; > =A0 =A0subtype tester__A9b is opengl__image ((R11b.all)'first(1) .. > (R11b.all)' > =A0 =A0 =A0last(1), (R11b.all)'first(2) .. (R11b.all)'last(2)); > =A0 =A0[constraint_error when > =A0 =A0 =A0(R11b.all)'last(2) >=3D (R11b.all)'first(2) and then ((R11b.al= l)' > =A0 =A0 =A0 =A0first(2) < 0 or else (R11b.all)'last(2) > 65535) > =A0 =A0 =A0"range check failed"] > =A0 =A0[constraint_error when > =A0 =A0 =A0(R11b.all)'last(1) >=3D (R11b.all)'first(1) and then ((R11b.al= l)' > =A0 =A0 =A0 =A0first(1) < 0 or else (R11b.all)'last(1) > 65535) > =A0 =A0 =A0"range check failed"] > =A0 =A0case_2 : access opengl.opengl__image :=3D new opengl.opengl__image= '( > =A0 =A0 =A0tester__A9b?((media__video__next_frame (the_movie, selfL =3D> > 0)))); > =A0 =A0[subtype tester__T6b is access opengl__image] > =A0 =A0reference tester__T6b > =A0 =A0null; > =A0 =A0return; > at end > =A0 =A0tester___clean; > end tester; > > =A0 =A0For Case_2, it appears the 1st call to next_Frame is used purely t= o > 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. What compiler do you use? Do you mind to post the complete (minimum required) source. I would like to see if I get the same result on my machine. Anh Vo