Segmentation fault before main

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Nov 5 09:21:00 GMT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20151105/efee11e3/attachment.sig>


More information about the Cygwin mailing list