comp.lang.ada
 help / color / mirror / Atom feed
From: "Per & Marianne sandberg" <sandberg@mail.bigpond.com>
Subject: Compiler bug (Semantics of pargma inline)
Date: 1999/03/24
Date: 1999-03-24T00:00:00+00:00	[thread overview]
Message-ID: <V2TJ2.39813$Hn5.21599@newsfeeds.bigpond.com> (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








             reply	other threads:[~1999-03-24  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-24  0:00 Per & Marianne sandberg [this message]
1999-03-24  0:00 ` Compiler bug (Semantics of pargma inline) Niklas Holsti
1999-03-24  0:00 ` Chad Bremmon
1999-03-25  0:00 ` Per & Marianne sandberg
replies disabled

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