[Boost-bugs] [Boost C++ Libraries] #2809: [patch] Date Time exception with MinGW

Subject: [Boost-bugs] [Boost C++ Libraries] #2809: [patch] Date Time exception with MinGW
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-27 15:40:34


#2809: [patch] Date Time exception with MinGW
--------------------------+-------------------------------------------------
 Reporter: Claudio Bley | Owner:
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: None
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 Hi.

 I'm using Boost version 1.38 under Windows using MinGW.

 When trying to use the this_thread::sleep function I got the following
 exception:

 "could not convert calendar time to UTC time"

 During compilation I received the following compiler warning:

 {{{
 ../../../../boost/date_time/filetime_functions.hpp: In function `uint64_t
 boost::date_time::winapi::file_time_to_microseconds(const FileTimeT&)':
 ../../../../boost/date_time/filetime_functions.hpp:101: warning: left
 shift count >= width of type
 }}}

 regarding the following code:
 {{{
 #!cpp
 const uint64_t c1 = 27111902UL;
 const uint64_t c2 = 3577643008UL;
 const uint64_t shift = (c1 << (32)) + c2; // issues warning without 'UL'
 }}}
 It seems GCC over-optimizes this case as it replaces the variables with
 the corresponding literal values. Since 27111902UL is just an '''unsigned
 long''' (not an '''unsigned long long''') it is only 32 bit wide (on my
 machine) -- leading to the compiler warning above.

 To fix this issue, the literals need to be written using the ULL suffix or
 the suggested patch (attached) needs to be applied.

 Regards,
 Claudio

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2809>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC