X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; q=dns; s=default; b=Ce2TgxQ4zqyhWIv5pbQu1iiMVGsf8
	krFdtS0PDfOUXiDmeTrG+cAAUGyOqnQ9ckZe6xVoAgRsbHbKQLOr2BG7dulHsQSk
	flKDubZjcStXWg9dCHRoq+Wx8SiJxuJgoPj83elSKhqgi43i9Nxa1i+178/0ZFQu
	K5vjaBorbUnM5E=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; s=default; bh=C5vvdPjoQgzlARWL1GQ+w82J6K8=; b=uWc
	C97Hxea+KKTsWLDxsgeDpX93tQmMDduglNfJipkMZZy7YkRpP3eXmvKsl6hVQ5pK
	b2rTJMl4fhyinCMadDEIUrxFPnSbbtrbgF37tLcRtXjBhuQD5XXQULZwxYmyPcwm
	yj2yH4cBG6lHtQn8Edb9xqCar5MB7T114QNfVOWk=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=CYGWIN_NT100, z87extream4, Masamichi, cygwin_nt100
X-HELO: mail-ua0-f178.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:mime-version:from:date:message-id:subject:to;        bh=9jxHwFdegN/tsxAM/X8tyFSNTr0nWKOpzt91Lyj7bVk=;        b=RUwOdQsiuZZHDGXSVkBRer6zDpAm9vUtvgWqdfnN04O9m5A2iBym4K3knrd7ASo2Pk         kf4fpR0/BzXlWSvn8DlAhODHFC+QUPFBZbdARMhdaBYtXKtDg29EdFw9JH9Tl5X44ZG5         AYYFCE5lhGrkrScqTigfb44rxM+o2T7cel9R4SDnCFvdHt1IuehrNSZHKFrMuHQ0TZOk         Bj3Z5t8Tm8YW85MHSrOriq3ng/JHnv6skL5zGPJ1hNywyZKrogYcwWTyMv4L2tIIWRsC         jyad5r8UhgfbpIAfw2nNCKdkX7SfhFQnrCJG0n4xoqiaPxJQpTQ32TO9O+RRfFP+vRzC         Ha9A==
X-Gm-Message-State: AIVw111lz/LvFaIuDrWOzC3bqWIwpYdYid99sw7NNjJv9thH22mjnby+	kUxTQvPuwr/LUBkJvef3sUqnTWwWFhTw
X-Received: by 10.176.2.84 with SMTP id 78mr474922uas.80.1499429394964; Fri, 07 Jul 2017 05:09:54 -0700 (PDT)
MIME-Version: 1.0
From: Ivan Gagis <igagis@gmail.com>
Date: Fri, 7 Jul 2017 15:09:54 +0300
Message-ID: <CAL_02JCZd=vQoAUDX6o6SZe6JJSWi1W-oUhCqYrgz3+KM4nV-g@mail.gmail.com>
Subject: Re: g++ std::map initializing raises segmentation fault.
To: The Cygwin Mailing List <cygwin@cygwin.com>
Content-Type: text/plain; charset="UTF-8"
X-IsSubscribed: yes

Hi,

I'm having the same problem after updating to latest cygwin packages.
It seems quite important problem, are there any plans to fix it?

Trying to debug the test program from Masamichi Hosoda it can be seen
that crash occurs in std::map implementation, see stacktrace below. I
wonder if there was any update to STL recently in cygwin?


Program received signal SIGSEGV, Segmentation fault.
0x0000000100401bf4 in std::less<int>::operator()(int const&, int
const&) const ()
(gdb) bt
#0  0x0000000100401bf4 in std::less<int>::operator()(int const&, int
const&) const ()
#1  0x00000001004028dd in std::_Rb_tree<int, std::pair<int const,
int>, std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<int
const, int> >, int const&) ()
#2  0x0000000100402685 in std::_Rb_tree_iterator<std::pair<int const,
int> > std::_Rb_tree<int, std::pair<int const, int>,
std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_insert_unique_<std::pair<int const, int> const&,
std::_Rb_tree<int, std::pair<int const, int>,
std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_Alloc_node>(std::_Rb_tree_const_iterator<std::pair<int const, int>
>, std::pair<int const, int> const&, std::_Rb_tree<int, std::pair<int
const, int>, std::_Select1st<std::pair<int const, int> >,
std::less<int>, std::allocator<std::pair<int const, int> >
>::_Alloc_node&) ()
#3  0x0000000100402579 in void std::_Rb_tree<int, std::pair<int const,
int>, std::_Select1st<std::pair<int const, int> >, std::less<int>,
std::allocator<std::pair<int const, int> >
>::_M_insert_unique<std::pair<int const, int> const*>(std::pair<int
const, int> const*, std::pair<int const, int> const*) ()
#4  0x0000000100401fec in std::map<int, int, std::less<int>,
std::allocator<std::pair<int const, int> >
>::map(std::initializer_list<std::pair<int const, int> >,
std::less<int> const&, std::allocator<std::pair<int const, int> >
const&) ()
#5  0x00000001004011a8 in __static_initialization_and_destruction_0(int, int) ()
#6  0x000000010040120a in _GLOBAL__sub_I_m ()
#7  0x0000000180045ef5 in do_global_ctors (force=0,
in_pfunc=0x100402ec0 <___CTOR_LIST__>) at
/usr/src/debug/cygwin-2.8.1-1/winsup/cygwin/dcrt0.cc:77
#8  __main () at /usr/src/debug/cygwin-2.8.1-1/winsup/cygwin/dcrt0.cc:1128
#9  0x00000001004010ed in main ()

Br,
Ivan

>
> From: Masamichi Hosoda <trueroad at trueroad dot jp>
> To: cygwin at cygwin dot com
> Date: Thu, 06 Jul 2017 21:26:22 +0900 (JST)
> Subject: g++ std::map initializing raises segmentation fault.
> Authentication-results: sourceware.org; auth=none
>
>
> Hello,
>
> On Cygwin 2.8.1 x86_64, I've found that g++ std:map initializing
> may raise segmentation fault.
> The binary compiled with cygwin-devel-2.8.0-1
> does not raise segmentation fault
> even if on Cygwin 2.8.1 x86_64 environments.
>
> So I suspect cygwin-devel-2.8.1-1 is the cause.
>
> Here's sample code for reproduce.
>
> ```
> // foo.cc
> // g++ -std=c++11 foo.cc
>
> #include<iostream>
> #include<map>
>
> std::map<int, int> m
> {
>   { 1, 1},
>   { 2, 2}
> };
>
> int main ()
> {
>   std::cout << "Hello World!" << std::endl;
> }
> ```
>
> I've reproduced it on both Windows 7 64 bit and Windows 10 64 bit.
>
> ```
> $ ./a
> Segmentation fault (core dumped)
>
> $
> ```
>
> Here's my environment.
>
> ```
> $ uname -a
> CYGWIN_NT-10.0 Z87EXTREAM4 2.8.1(0.312/5/3) 2017-07-03 14:11 x86_64 Cygwin
>
> $ g++ --version
> g++ (GCC) 5.4.0
> Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
> $
> ```
>
> Thanks

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

