public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/39602]  New: Clock function freezes in infinite loop when run under wine on linux
@ 2009-03-31 13:42 vldmrrr at yahoo dot com
  2009-10-03 10:57 ` [Bug ada/39602] " sam at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: vldmrrr at yahoo dot com @ 2009-03-31 13:42 UTC (permalink / raw)
  To: gcc-bugs

Here is the program:
----------tst.adb------
with Ada.Calendar;
with Ada.Text_IO;use Ada.Text_IO;
procedure tst is
    t: Ada.Calendar.Time;
begin
    Put_Line ("Calling clock");
    t := Ada.Calendar.Clock;
    Put_Line ("Got clock" );
end tst;
-------------------

Built program runs fine under windows xp. When the same executable is run under
wine on linux it freezes without any printouts. The program is spinning inside
the loop in function System.OS_Primitives.Get_Base_Time
(lib\gcc\i686-pc-mingw32\4.3.3\adainclude\s-osprim.adb):

----------s-osprim.adb-----------
      --  Here we must be sure that both of these calls are done in a short
      --  amount of time. Both are base time and should in theory be taken
      --  at the very same time.

      loop
         GetSystemTimeAsFileTime (Base_Time'Access);

         if QueryPerformanceCounter (Base_Ticks'Access) = Win32.FALSE then
            pragma Assert
              (Standard.False,
               "Could not query high performance counter in Clock");
            null;
         end if;

         GetSystemTimeAsFileTime (Test_Now'Access);

         exit when Test_Now - Base_Time = Max_Elapsed;
      end loop;
-------------------------

Apparently the assumption does not hold under wine and loop is never exited.
What this code tries to achieve is close correlation between times returned by
GetSystemTimeAsFileTime and QueryPerformanceCounter. But in actual place where
the two values are used (the Clock function) the same effort is not made, so it
looks like that this approach will not achieve what it is intended for. I
suggest removing this loop altogether.


-- 
           Summary: Clock function freezes in infinite loop when run under
                    wine on linux
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vldmrrr at yahoo dot com
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39602


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

* [Bug ada/39602] Clock function freezes in infinite loop when run under wine on linux
  2009-03-31 13:42 [Bug ada/39602] New: Clock function freezes in infinite loop when run under wine on linux vldmrrr at yahoo dot com
@ 2009-10-03 10:57 ` sam at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: sam at gcc dot gnu dot org @ 2009-10-03 10:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sam at gcc dot gnu dot org  2009-10-03 10:57 -------
This has been fixed in commit 149326 and will be in GCC 4.5.0.

    2009-07-07  Pascal Obry  <obry@adacore.com>

        * s-osprim-mingw.adb (Get_Base_Time): Avoid infinite loop.


-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39602


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

end of thread, other threads:[~2009-10-03 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 13:42 [Bug ada/39602] New: Clock function freezes in infinite loop when run under wine on linux vldmrrr at yahoo dot com
2009-10-03 10:57 ` [Bug ada/39602] " 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).