comp.lang.ada
 help / color / mirror / Atom feed
From: Anh Vo <anhvofrcaus@gmail.com>
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)
Date: 2011-05-06T16:41:44-07:00	[thread overview]
Message-ID: <e0b21dad-a483-4b1e-a43b-25a47f165840@j23g2000yqc.googlegroups.com> (raw)
In-Reply-To: dcd4d840-479f-4bb0-8eb4-3d62acd91474@k15g2000pri.googlegroups.com

On May 5, 5:49 pm, Rod Kay <rod....@aulace.com> wrote:
> On May 6, 3:07 am, Florian Weimer <f...@deneb.enyo.de> 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 :=
>      $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 := media.
>      media__video.media__video__new_video__2 ("xyz.avi");
>    [constraint_error when
>      the_movie = null
>      "access check failed"]
>
>    -- Case 1 begins here ...
>    type tester__A3b is access all opengl__image;
>    R4b : constant tester__A3b := media__video__next_frame (the_movie,
>      selfL => 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) >= 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) >= 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)) := R4b.all;
>
>    -- Case 2 begins here ...
>    type tester__A10b is access all opengl__image;
>    R11b : constant tester__A10b := (media__video__next_frame
> (the_movie,
>      selfL => 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) >= (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) >= (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 := new opengl.opengl__image'(
>      tester__A9b?((media__video__next_frame (the_movie, selfL =>
> 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.

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



  reply	other threads:[~2011-05-06 23:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  3:52 Problem where a function is invoked once but called twice (when invocation is within an allocator) Rod Kay
2011-05-05  5:43 ` J-P. Rosen
2011-05-05  6:12   ` Rod Kay
2011-05-05  8:22   ` Yannick Duchêne (Hibou57)
2011-05-05 10:59     ` Rod Kay
2011-05-05 17:07       ` Florian Weimer
2011-05-06  0:49         ` Rod Kay
2011-05-06 23:41           ` Anh Vo [this message]
2011-05-07  1:38             ` Rod Kay
2011-05-07  9:06               ` Georg Bauhaus
2011-05-07  9:45                 ` Rod Kay
2011-05-09 16:01               ` Anh Vo
2011-05-09 23:00                 ` Dan
2011-05-10  0:14                   ` Anh Vo
2011-05-10  0:24                     ` Rod Kay
2011-05-10  0:55                       ` Anh Vo
2011-05-11 17:23                         ` Dan
2011-05-12 22:35                         ` Rod Kay
2011-05-13 17:40                           ` Ludovic Brenta
2011-05-10  0:21                   ` Rod Kay
  -- strict thread matches above, loose matches on Subject: below --
2011-05-14  0:27 Rod Kay
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox