[Bug ada/39602] New: Clock function freezes in infinite loop when run under wine on linux

vldmrrr at yahoo dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 31 13:42:00 GMT 2009


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



More information about the Gcc-bugs mailing list