comp.lang.ada
 help / color / mirror / Atom feed
* Re: Compiler bug (Semantics of pargma inline)
  1999-03-24  0:00 Compiler bug (Semantics of pargma inline) Per & Marianne sandberg
  1999-03-24  0:00 ` Chad Bremmon
@ 1999-03-24  0:00 ` Niklas Holsti
  1999-03-25  0:00 ` Per & Marianne sandberg
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Holsti @ 1999-03-24  0:00 UTC (permalink / raw)


Per & Marianne sandberg wrote:
          [snip] 
>   function Until_Next return Duration;
>   pragma Inline (Until_Next);
          [snip]
>   select
          [snip]
>   or
>      when Is_Pending =>
>         delay (Until_Next);
>         Text_Io.Put_Line ("Gaah!");
>   end select;
          [snip]
> What appends is when pragma inline is used on the "Until_Next"
> function the function is called even if
> the guard "Is_Pending" evaluates to false and i considder this a bug
> regardles of inline or not.

According to LRM 9.7.1(15), defining the dynamic semantics of
the Selective Accept, "For an open delay_alternative, the
delay_expression is also evaluated." This implies, IMHO,
that for a closed delay_alternative, the delay_expression
should not be evaluated. Since Is_Pending returns False,
the alternative is closed, and Until_Next should not be
called. So I tend to agree with you.

Niklas Holsti
Working at but not speaking for Space Systems Finland Ltd.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler bug (Semantics of pargma inline)
  1999-03-24  0:00 Compiler bug (Semantics of pargma inline) Per & Marianne sandberg
@ 1999-03-24  0:00 ` Chad Bremmon
  1999-03-24  0:00 ` Niklas Holsti
  1999-03-25  0:00 ` Per & Marianne sandberg
  2 siblings, 0 replies; 4+ messages in thread
From: Chad Bremmon @ 1999-03-24  0:00 UTC (permalink / raw)


I agree. . . that's a bug.  Complain to your compiler vendor.

I compiled it under Apex and it works fine both ways. . .

Chad

>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Compiler bug (Semantics of pargma inline)
@ 1999-03-24  0:00 Per & Marianne sandberg
  1999-03-24  0:00 ` Chad Bremmon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Per & Marianne sandberg @ 1999-03-24  0:00 UTC (permalink / raw)


Hi !
Is the compiler aloud to change the semantic of the code if pargma inline is
used ?
I am asking this question bue to different opinons from my self and the
compiler vendor.
Never the less here is the code.

----------------------------------------------
with Text_Io;
procedure Timer_Test is

    function Until_Next return Duration;
    pragma Inline (Until_Next);

    function Until_Next return Duration is
    begin
 Text_Io.Put_Line ("Should never get here!!!");
 return 5.0;
    end Until_Next;

    function Is_Pending return Boolean is
    begin
 return False;
    end Is_Pending;

    task type Test_Task_Type is
 entry Start;
 entry Stop;
    end Test_Task_Type;

    Test_Task : Test_Task_Type;

    task body Test_Task_Type is
 Continue : Boolean := True;
    begin
 while Continue loop
     begin
  select
      accept Start do
   Text_Io.Put_Line ("Start.");
      end Start;
  or
      accept Stop do
   Text_Io.Put_Line ("Stop.");
   Continue := False;
      end Stop;
  or
      when Is_Pending =>
   delay (Until_Next);
   Text_Io.Put_Line ("Gaah!");
  end select;
     exception
  when others =>
      Text_Io.Put_Line ("Ops! Exception...");
     end;
 end loop;
    end Test_Task_Type;

begin
    Test_Task.Start;

    delay 15.0;

    Test_Task.Stop;
end Timer_Test;
------------------------------------------------------------

What appends is when pragma inline is used on the "Until_Next" function the
function is called even if
the guard "Is_Pending" evaluates to false and i considder this a bug
regardles of inline or not.

Thankfull for ansvers to connvince my compiler vendor.
/Per Sandberg








^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler bug (Semantics of pargma inline)
  1999-03-24  0:00 Compiler bug (Semantics of pargma inline) Per & Marianne sandberg
  1999-03-24  0:00 ` Chad Bremmon
  1999-03-24  0:00 ` Niklas Holsti
@ 1999-03-25  0:00 ` Per & Marianne sandberg
  2 siblings, 0 replies; 4+ messages in thread
From: Per & Marianne sandberg @ 1999-03-25  0:00 UTC (permalink / raw)



Thanks for the answers
This was what i thougt also after reading the LRM and trying with the
folowing platforms.
    RS6000 aix 4.1 / apex    native
    RS6000 aix 4.1 / apex   MC68K target
    NT-i383     / GNAT
    Linux-i386 / GNAT

/PS








^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-03-25  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-24  0:00 Compiler bug (Semantics of pargma inline) Per & Marianne sandberg
1999-03-24  0:00 ` Chad Bremmon
1999-03-24  0:00 ` Niklas Holsti
1999-03-25  0:00 ` Per & Marianne sandberg

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