public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/41383] New: Timing_Events: Event time not cleared after Cancel_Handler
@ 2009-09-16 21:13 reet at codelabs dot ch
2009-10-02 20:48 ` [Bug ada/41383] " sam at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: reet at codelabs dot ch @ 2009-09-16 21:13 UTC (permalink / raw)
To: gcc-bugs
ARM D.15 about Ada.Real_Time.Timing_Events states:
9/2 An object of type Timing_Event is said to be set if it is associated
with a non-null value of type Timing_Event_Handler and cleared
otherwise. All Timing_Event objects are initially cleared.
17/2 The procedure Cancel_Handler clears the event if it is set.
Cancelled is assigned True if the event was set prior to it being
cleared; otherwise it is assigned False.
18/2 The function Time_Of_Event returns the time of the event if the
event is set; otherwise it returns Real_Time.Time_First.
There's a bug in the Cancel_Handler() procedure, because the event time remains
set and is not reset to Ada.Real_Time.Time_First (as required by 18/2).
Here is a small reproducer:
--
with Ada.Real_Time.Timing_Events;
package Timers is
use Ada.Real_Time.Timing_Events;
protected type Timer_Type is
procedure Setup (At_Time : Ada.Real_Time.Time);
function Get_Time return Ada.Real_Time.Time;
procedure Stop (Status : out Boolean);
private
procedure Handle (Event : in out Timing_Event);
Event : Timing_Event;
end Timer_Type;
end Timers;
--
package body Timers is
protected body Timer_Type is
function Get_Time return Ada.Real_Time.Time is
begin
return Event.Time_Of_Event;
end Get_Time;
procedure Handle (Event : in out Timing_Event) is
begin
null;
end Handle;
procedure Setup (At_Time : Ada.Real_Time.Time) is
begin
Event.Set_Handler (At_Time => At_Time,
Handler => Handle'Access);
end Setup;
procedure Stop (Status : out Boolean) is
begin
Event.Cancel_Handler (Cancelled => Status);
end Stop;
end Timer_Type;
end Timers;
--
with Ada.Text_IO;
with Ada.Real_Time;
with Timers;
procedure Cancel_Handler is
use Ada.Real_Time;
Handler : Timers.Timer_Type;
Timer : constant Time := Clock + Minutes (60);
begin
if Handler.Get_Time = Time_First then
Ada.Text_IO.Put_Line ("Time is Time_First ...");
end if;
Handler.Setup (At_Time => Timer);
if Handler.Get_Time = Timer then
Ada.Text_IO.Put_Line ("Handler set ...");
end if;
declare
Stopped : Boolean := False;
begin
Handler.Stop (Status => Stopped);
if Stopped then
Ada.Text_IO.Put_Line ("Timer cancelled ...");
if Handler.Get_Time = Timer then
Ada.Text_IO.Put_Line ("Why is the time still set then?");
end if;
end if;
end;
end Cancel_Handler;
--
Summary: Timing_Events: Event time not cleared after
Cancel_Handler
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reet at codelabs dot ch
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41383
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/41383] Timing_Events: Event time not cleared after Cancel_Handler
2009-09-16 21:13 [Bug ada/41383] New: Timing_Events: Event time not cleared after Cancel_Handler reet at codelabs dot ch
@ 2009-10-02 20:48 ` sam at gcc dot gnu dot org
2009-10-06 7:21 ` sam at gcc dot gnu dot org
2009-10-06 7:24 ` sam at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: sam at gcc dot gnu dot org @ 2009-10-02 20:48 UTC (permalink / raw)
To: gcc-bugs
--
sam at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |sam at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-10-02 20:48:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41383
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/41383] Timing_Events: Event time not cleared after Cancel_Handler
2009-09-16 21:13 [Bug ada/41383] New: Timing_Events: Event time not cleared after Cancel_Handler reet at codelabs dot ch
2009-10-02 20:48 ` [Bug ada/41383] " sam at gcc dot gnu dot org
@ 2009-10-06 7:21 ` sam at gcc dot gnu dot org
2009-10-06 7:24 ` sam at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: sam at gcc dot gnu dot org @ 2009-10-06 7:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from sam at gcc dot gnu dot org 2009-10-06 07:21 -------
Subject: Bug 41383
Author: sam
Date: Tue Oct 6 07:20:53 2009
New Revision: 152487
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152487
Log:
gcc/ada/
PR ada/41383
* a-rttiev.adb (Time_Of_Event): Return Time_First for unset event.
gcc/testsuite/
PR ada/41383
* gnat.dg/timer_cancel.adb: New test.
Added:
trunk/gcc/testsuite/gnat.dg/timer_cancel.adb
Modified:
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/a-rttiev.adb
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41383
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/41383] Timing_Events: Event time not cleared after Cancel_Handler
2009-09-16 21:13 [Bug ada/41383] New: Timing_Events: Event time not cleared after Cancel_Handler reet at codelabs dot ch
2009-10-02 20:48 ` [Bug ada/41383] " sam at gcc dot gnu dot org
2009-10-06 7:21 ` sam at gcc dot gnu dot org
@ 2009-10-06 7:24 ` sam at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: sam at gcc dot gnu dot org @ 2009-10-06 7:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from sam at gcc dot gnu dot org 2009-10-06 07:23 -------
This bug has been fixed in SVN trunk. Thanks for your very detailed report.
--
sam at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41383
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-06 7:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 21:13 [Bug ada/41383] New: Timing_Events: Event time not cleared after Cancel_Handler reet at codelabs dot ch
2009-10-02 20:48 ` [Bug ada/41383] " sam at gcc dot gnu dot org
2009-10-06 7:21 ` sam at gcc dot gnu dot org
2009-10-06 7:24 ` sam at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).