This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Segmentation fault before main


Hi Corinna,

as mention some time ago, testing netcdf 4.4.0 release candidates
I see a puzzling SIGSEGV before reaching main, so something goes wrong
on cygwin loading/inizialization of the program.

It happens in a simple test programs that is linked to
cygnetcdf-7.dll and its only job is to create a test file
called ctest0.nc.

Previous 4.3.3.1 test case runs fine.
The new ctest.c fails both with the new and with the old library.
Test case and binaries are here :
  http://matzeri.altervista.org/works/segfault/

$ gcc ctest.c -o ctest.exe -lnetcdf

$ gdb ./ctest.exe
(gdb) break main
Breakpoint 1 at 0x100401171
(gdb) run
Starting program: /cygdrive/e/cyg_pub/devel/netcdf/tests/ctest-440.exe
[New Thread 8404.0x18f4]
[New Thread 8404.0xa8c]
[New Thread 8404.0x2270]

Program received signal SIGSEGV, Segmentation fault.
___chkstk_ms () at /usr/src/debug/gcc-4.9.3-1/libgcc/config/i386/cygwin.S:146
146             orq     $0x0, (%rcx)            /* probe there */


$ uname -svrm
CYGWIN_NT-6.1 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64


libnetcdf-devel                         4.3.3.1-2
libnetcdf7                              4.3.3.1-2
netcdf                                  4.3.3.1-2
netcdf-debuginfo                        4.3.3.1-2


Unfortunately I have no clue about this code:

/* ___chkstk_ms is a *special* function call, which uses %rax as the argument.
   We avoid clobbering any registers.  Unlike ___chkstk, it just probes the
   stack and does no stack allocation.  */
        .global ___chkstk_ms
#ifdef __x86_64__
        cfi_startproc()
___chkstk_ms:
        pushq   %rcx                    /* save temps */
        cfi_push(%rcx)
        pushq   %rax
        cfi_push(%rax)
        cmpq    $0x1000, %rax           /* > 4k ?*/
        leaq    24(%rsp), %rcx          /* point past return addr */
        jb      2f

1:      subq    $0x1000, %rcx           /* yes, move pointer down 4k */
        orq     $0x0, (%rcx)            /* probe there */

Any help will be really appreciated.

Regards
Marco

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]