FPE in localtime.cc

Lavrentiev, Anton (NIH/NLM/NCBI) [C] lavr@ncbi.nlm.nih.gov
Mon Jul 9 15:47:00 GMT 2018


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

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

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

More information about the Cygwin mailing list