public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vldmrrr at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/39602]  New: Clock function freezes in infinite loop when run under wine on linux
Date: Tue, 31 Mar 2009 13:42:00 -0000	[thread overview]
Message-ID: <bug-39602-10318@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-03-31 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 13:42 vldmrrr at yahoo dot com [this message]
2009-10-03 10:57 ` [Bug ada/39602] " sam at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39602-10318@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).