Web lists-archives.com

Re: g++ std::map initializing raises segmentation fault.




> On 07/07/2017 16:21, Ivan Gagis wrote:
>> I installed g++ 6.3.0-2 and still can reproduce the segfault :(.
>>
>> Br,
>> Ivan
>>
> 
> It seems due to the -std=c++11 restriction
> 
> $ g++ foo.cc
> 
> $ ./a.exe
> Hello World!
> 
> $ g++ -std=c++11 foo.cc
> 
> $ ./a.exe
> Segmentation fault (core dumped)



Even if g++ 6.3.0-2 with `-std=c++11`,
there is no problem if cygwin-devel-2.8.0-1 is installed.



```
$ uname -a
CYGWIN_NT-10.0 inspiron5559 2.8.1(0.312/5/3) 2017-07-03 14:11 x86_64 Cygwin

$ cygcheck -c cygwin-devel
Cygwin Package Information
Package              Version        Status
cygwin-devel         2.8.0-1        OK

$ g++ --version
g++ (GCC) 6.3.0
Copyright (C) 2016 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.


$ g++ -std=c++11 foo.cc

$ ./a
Hello World!

$ g++ -std=gnu++11 foo.cc

$ ./a
Hello World!

$
```



However, if cygwin-devel-2.8.1-1 is installed, segmentation fault is raised.



```
$ uname -a
CYGWIN_NT-10.0 inspiron5559 2.8.1(0.312/5/3) 2017-07-03 14:11 x86_64 Cygwin

$ cygcheck -c cygwin-devel
Cygwin Package Information
Package              Version        Status
cygwin-devel         2.8.1-1        OK

$ g++ --version
g++ (GCC) 6.3.0
Copyright (C) 2016 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.


$ g++ -std=c++11 foo.cc

$ ./a
Segmentation fault (core dumped)

$ g++ -std=gnu++11 foo.cc

$ ./a
Hello World!

$
```



So the cause is cygwin-devel-2.8.1-1 in my humble opinion.

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