public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Segmentation fault before main
@ 2015-10-30 19:18 Marco Atzeri
  2015-10-30 21:23 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Atzeri @ 2015-10-30 19:18 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-05 13:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 19:18 Segmentation fault before main Marco Atzeri
2015-10-30 21:23 ` Corinna Vinschen
2015-10-31 16:47   ` Marco Atzeri
2015-11-04 21:42     ` Marco Atzeri
2015-11-05  8:49       ` Csaba Raduly
2015-11-05 13:11         ` Marco Atzeri
2015-11-05  9:21       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).