delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/05/14/09:40:09

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=D52mRNsbukVqWxSxtlB7ShGoi8+3AgLfKg+an4oYvsxEcZGh0tUt4
85fZ+ngAUDy04iawh4FJvgu7boyMlBYrC0KPVsTKiZo03Hd91gxS8gKe7dM2QVW6
yrv/CLYnge26P0ax4nIHfQx43BG+AAg75/ouN4hr1tSllaY/XpD2vY=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=T0W4aVusbZZdnlCNDp/h7T7uN6U=; b=yzVaOqb0vhH1tKGpJ8a1HTOU8g+P
8/qDTjTG2xeKZjUw7+3/h1SUmt3A6XqbHzn7Cof31Syb5jLKcDrQNzwRl5/yci6S
H6iWMAEOlpHh3AcIgewNUOWc/x/0c8tN6YqNfKKUJnrcN35fbnO59cVCnSRDRZPF
1NCRHPZL0Y0fMHM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1
Date: Tue, 14 May 2013 15:39:50 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: mktime loop
Message-ID: <20130514133950.GC23910@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5244063b734b165baf34bdebaff0aca5 AT denis-excoffier DOT org> <20130513153651 DOT GD5045 AT calimero DOT vinschen DOT de> <20130513154921 DOT GF8890 AT calimero DOT vinschen DOT de> <27BBE8FE-303A-432D-94AA-AF834124D125 AT Denis-Excoffier DOT org> <20130513165712 DOT GH8890 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20130513165712.GH8890@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)

On May 13 18:57, Corinna Vinschen wrote:
> On May 13 18:41, Denis Excoffier wrote:
> > On 2013-05-13 17:49, Corinna Vinschen wrote:
> > > Erm... hang on.  Is that really a problem?  2147483647 is 0x7fffffff,
> > > which is the maximum you get with a 4 byte time_t (== signed long)
> > > anyway.  If you switch the date to 2038-01-20, the value will be
> > > negative, and therefore outside the scope of the 4 byte time_t.  So this
> > > is a hard restriction of using 4 byte time_t.
> > > 
> > > The solution is:
> > > 
> > > - Either somebody changes 32 bit Cygwin to 8 byte time_t while keeping
> > >  all the 4 byte time_t APIs intact to maintain compatibility with
> > >  existing binaries(*),
> > > 
> > > - or, you switch to a 64 bit Windows and use 64 bit Cygwin ;)
> > > 
> > I understand.
> > 
> > I suppose you will however be willing to provide us a means to workaround
> > the "autoconf mktime usability test failing" (see for example in
> > gawk-4.1.0 where all the tm fields are set to 128). Now, instead of only
> > failing (i presume), it hangs. Sorry, this specific point should have been
> > noticed in my original post.
> > 
> > Or do we have to patch every impacted ./configure?
> 
> Good point.  I guess the right thing to do here is for mktime to
> return -1 instead of hanging.  I look into that.

Looks like this is a result of gcc optimization settings.  The upstream
code computing time_t <-> struct tm conversions requires integer
overflow to be fully defined, but gcc's -O2 option sets
-fstrict-overflow which results in all kinds of agressive integer
optimizations which disabled utilizing integer overflows for serious
purposes.  I fixed that by setting the -fwrapv option when building the
affected localtime.cc file (thanks to Kai Tietz for pointing this out).


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019