delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/07/09/11:47:31

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:from:to:subject:date:message-id:content-type
:content-transfer-encoding:mime-version; q=dns; s=default; b=XYo
GVSTxDpWc0Dho+2ql215BAg3EZUrd2g3KUQZY6hZaV/4AMTJwqSe+OlK8tA7ZYX1
LaGwQgzR9UdbYi1jMvG8T1w2H/zQSamKF7nG5qBLOInGWBfrPT6TMsKWjELFoTS5
KpQbEjgz6eb/Oh8VhMH/BdLVBcRKzzw3XGoO54Xo=
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:from:to:subject:date:message-id:content-type
:content-transfer-encoding:mime-version; s=default; bh=Jk/6JJCcq
mKGUgHUPUrlB/en5SQ=; b=MWPkxtmX8+324uXG2rqsvS/F+zRLR90YPjVYExZH7
hIPjy0Xve7MHIkqutTKqmuBBsknv0JOen28u5A4M4MbP6KTwEblZiyrE0y0M0gOL
gKNslyr9hzRnrkfJ9FvdHdzpS+C6lizeQ+PVNRvx5ki4U882YOLhPrOCD8NHfoOa
0w=
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 spammy=
X-HELO: nihcesxway6.hub.nih.gov
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nih.onmicrosoft.com; s=selector1-ncbi-nlm-nih-gov; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KyN3ydwNFazxcycKOSJkEoUs22wQh7VqZINIu6QNPq0=; b=lMDhzVjC9tMIY2rWsB/bt0ss/MNd6zUN3zetSrzFc6pDDNotA0QkRcXVrZ1pIVvVnAQQJYrthAorlfnHUf1HUsqSbZ19uiO1lcWwMAUzGk7EaAxZly8RHMXtyR0xppvsa9WyaS33XdRzRG/eOFDiGr1PdXz2nhbFppSqoYIQLHM=
From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr AT ncbi DOT nlm DOT nih DOT gov>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: FPE in localtime.cc
Date: Mon, 9 Jul 2018 15:47:14 +0000
Message-ID: <CY4PR09MB1302CB30716988BB7BB61EF3A5440@CY4PR09MB1302.namprd09.prod.outlook.com>
authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr AT ncbi DOT nlm DOT nih DOT gov;
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id w69FlTne004612

Hello,

the following sample coredumps with FPE at localhost.cc:1962 with the latest snapshot (6/29/2018):

#define _GNU_SOURCE
#include <fenv.h>
#include <time.h>
#include <stdio.h>

static time_t s_Time;

static void fun(void)
{
  char buf[40];
  strftime(buf, sizeof(buf), "%m/%d/%y %H:%M:%S", localtime(&s_Time));
  printf("%s\n", buf);
}

int main()
{
  feenableexcept(FE_ALL_EXCEPT);
  time(&s_Time);
  fun();
}

$ cat a.exe.stackdump
Exception: STATUS_FLOAT_INEXACT_RESULT at rip=001800BBA24
rax=000000000000016D rbx=000000005B43498E rcx=00000000000001EC
rdx=1845C8A0CE512957 rsi=0000000051EB851F rdi=2CC3D8D4A245F203
r8 =0000000000F92B80 r9 =00000000FFFFFFED r10=00000000000007E2
r11=000000000000000C r12=00000000FFFFFFFF r13=0000000080000000
r14=00000000000000BD r15=00000000000007E2
rbp=000000007FFFFFFF rsp=00000000FFFFCA70
program=C:\Cygwin64\...\a.exe, pid 14232, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B

Removing the first line of the main() function lets the program run successfully.
The same code runs fine unmodified on Linux.

$ gcc -Wall sample.c -lm
$ ./a.out
07/09/18 11:44:26

Any ideas?

Thanks,
Anton Lavrentiev


--
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