cpp /usr/include/threads.h fails; modfl segfaults

airplanemath airplanemath@aol.com
Sat Aug 29 12:52:48 GMT 2020


I have two reports.  A brief description of the system:
$ uname -a | sed "s/${HOSTNAME}/\${HOSTNAME}/g"
CYGWIN_NT-10.0 ${HOSTNAME} 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin

The first report:

$ cpp /usr/include/threads.h
# 1 "/usr/include/threads.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/threads.h"
/usr/include/threads.h:30:10: fatal error: machine/_threads.h: No such
file or directory
   30 | #include <machine/_threads.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

$ cygcheck -p machine/_threads.h
Found 0 matches for machine/_threads.h

$ cygcheck -f /usr/include/threads.h

$ cygcheck -c cygwin-devel
Cygwin Package Information
Package              Version        Status
cygwin-devel         3.1.7-1        OK

I'm not sure what to do from here.  I don't remember where I ran into this,
but this feels like something that shouldn't happen

The second report:

$ cat test.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  long double a, b, c;
  char *num_end = NULL;
  a = b = c = 0.0L;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s NUMBER\n", argv[0]);
  a = strtold(argv[1], &num_end);
  b = modfl(a, &c);
  printf("%Lf %Lf %Lf\n", a, b, c);
  return 0;

$ gcc -Og -ggdb -g3 -Wall -Wextra -std=c99 -pedantic test.c -o test.exe

$ ./test.exe 123.456
Segmentation fault (core dumped)

$ gdb --args ./test.exe 123.456
GNU gdb (GDB) (Cygwin 8.3.1-1) 8.3.1
Reading symbols from ./test.exe...
(gdb) break modfl
(gdb) run
Starting program: /home/Daniel/test.exe 123.456
[New Thread 13960.0x3cf4]
[New Thread 13960.0xbdc]
[New Thread 13960.0x4028]
[New Thread 13960.0x3224]
[New Thread 13960.0x3810]
[New Thread 13960.0x1ae4]
[New Thread 13960.0x3714]
[Thread 13960.0x4028 exited with code 3697672192]
[Thread 13960.0x3714 exited with code 0]

Thread 1 "test" hit Breakpoint 1, modfl (value=<optimized out>,
iptr=iptr@entry=0xffffcbd0) at
16        asm ("subq $8, %%rsp\n"
(gdb) step
38        if (iptr)
(gdb) step
39          *iptr = int_part;
(gdb) step
40        return (isinf (value) ?  0.0L : value - int_part);
(gdb) step
      0 [main] test 28439 cygwin_exception::open_stackdumpfile: Dumping
stack trace to test.exe.stackdump
[Thread 13960.0x3b5c exited with code 35584]
[Thread 13960.0x1ae4 exited with code 35584]
[Thread 13960.0x3810 exited with code 35584]
[Thread 13960.0xbdc exited with code 35584]
[Thread 13960.0x3cf4 exited with code 35584]
[Inferior 1 (process 13960) exited with code 0105400]

isinf and isinfl both work just fine, so I'm not sure what's going on there.

Please let me know if you need more information.

More information about the Cygwin mailing list