public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Segmentation fault before main
Date: Thu, 05 Nov 2015 09:21:00 -0000	[thread overview]
Message-ID: <20151105092110.GA18221@calimero.vinschen.de> (raw)
In-Reply-To: <563A7BD4.5050007@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]

On Nov  4 22:42, Marco Atzeri wrote:
> On 30/10/2015 20:45, Marco Atzeri wrote:
> >On 30/10/2015 20:18, Corinna Vinschen wrote:
> >>On Oct 30 16:25, Marco Atzeri wrote:
> >>>Hi Corinna,
> >>>
> >
> >>>Any help will be really appreciated.
> >>
> >>Well, it's a stack probe.  It's typically called when trying to allocate
> >>big datastructures on the stack, e.g. with alloca.  Did you try to raise
> >>the default stacksize in the executable header (see peflags -x and -X
> >>options).  There's not much else to work with...
> >>
> 
> 
> For the archive, I found the culprit in the test code.

I'm happy to read that.

> Using "%lu" to print int is not a good idea on cygwin 64 bit.
> 
> 
> -       bbprintf0(stmt,"%ssize_t %s_countset[%lu] = {",
> +       bbprintf0(stmt,"%ssize_t %s_countset[%u] = {",
>                         indented(1),
>                         cname(vsym),
>                         rank);

...and you wouldn't even have noticed it on Linux, because it uses the
SystemV ABI which passes the first 6 arguments in registers, in contrast
to the MS ABI which only passes the first 4 arguments in regs.

Thus on Linux you'd have silenty get the benefit of the CPU clearing the
upper 32 bits of a register when moving a 32 bit value into it, which
doesn't happen when moving a 32 bit argument to the stack.

That's one of the interesting side effects of porting an application.
Maybe it would make sense to mention this problem in
https://cygwin.com/faq/faq.html#faq.programming.64bitporting...

> as it could produce
> 
>     size_t br_startset[25769803777] = {0} ;
>     size_t br_countset[25769803777] = {2};

Ouch.

> instead of
>    size_t br_startset[1] = {0} ;
>    size_t br_countset[1] = {2};
> 
> 
> as 25769803777 = 0x00060001

I guess you mean 0x600000001 :)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

      parent reply	other threads:[~2015-11-05  9:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 19:18 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151105092110.GA18221@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).