delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/06/12/13:12:11

X-Recipient: archive-cygwin AT delorie DOT 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:from:subject:to:references:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=SXvT
lB3wf5siaks1Dn1k41r8DhoOsoQ0G9ew2CW6BSw2b3eYmopSgPV3Wefm/Fp3jQkN
PVOe2Uxw+hvfAWpHOByjoyz2+Sp4OrhkkP0vDl/fCKD3GyrVvsuCwBTpIp45u4zt
esdewtNm0ON/DvL4lHxL4l4VV1O34Wakp1Kfa9g=
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:from:subject:to:references:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=t0hrZ50b0g
7B1+8mB6K6jnZWMys=; b=EV9G/XDRp+jHZSKkT6kHk+Q6HKsVlMYRbullQUO1hT
CXd0q6LEfulUWBfP9RpHw8GGzzwxy7Gb93xpZckhXDHjHTAtyRCT+P5UzjOLDU2w
JtJZrRT246fSd/PrBofo1aXWK6AdqlGO6w0aaINyRDnrSWJWjeHEgpCOT4vBl3uT
M=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*r:encrypted, H*r:sk:mailout, christian
X-HELO: mailout12.t-online.de
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream
To: cygwin AT cygwin DOT com
References: <CAHVoUt2pHP46o6ERwx9HB5=Dn-J9xv5i-53RYtJbdev-K9DCeQ AT mail DOT gmail DOT com>
Message-ID: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de>
Date: Tue, 12 Jun 2018 19:11:49 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 SeaMonkey/2.50
MIME-Version: 1.0
In-Reply-To: <CAHVoUt2pHP46o6ERwx9HB5=Dn-J9xv5i-53RYtJbdev-K9DCeQ@mail.gmail.com>
X-IsSubscribed: yes

--------------2919FF0A3B0A158CCF9BFF23
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Ivan Shynkarenka wrote:
> I use x64 bit Cygwin and it failed in my home, work and Appveyor.  I add
> cygcheck.out with my environment.
>
> I'm sorry about misspell prefix space in my prev example. Please try the
> following one:
>
> #include <fstream>
> #include <iostream>
>
> int main(int argc, char** argv)
> {
>      std::string line;
>      std::ifstream stream("test.cpp");
>      while (getline(stream, line))
>          std::cout << line << std::endl;
>      return 0;
> }
>
> g++ -std=gnu++17 test.cpp

Could reproduce this with 32 and 64 bit Cygwin g++ 7.3.0

A comparison of preprocessor (-E) outputs shows that the "extern 
template" declarations for getline() are only visible for C++ <= 14. 
These are guarded by "__cplusplus <= 1402" in basic_string.tcc. This 
should tell the compiler to generate new code for getline() if C++17 is 
enabled instead of calling the (now incompatible) function in 
cygstdc++-6.dll.

A comparison of assembly (-S) outputs shows that this does not work: If 
C++17 is enabled, the compiler correctly generates local code for 
getline(istream &, string &) but this code calls an external 
getline(istream &, string &, char). Then the linker generates a call to 
this getline() in cygstdc++-6.dll.

This is because there is a bogus prototype specialization for 
getline(istream &, string &, char) in basic_string.h but no 
corresponding implementation in basic_string.tcc. This has apparently an 
equivalent effect as 'extern template'.

The attached patch for
   /usr/lib/gcc/*-pc-cygwin/7.3.0/include/c++/bits/basic_string.h
fixes this.

Christian


--------------2919FF0A3B0A158CCF9BFF23
Content-Type: text/plain; charset=UTF-8;
 name="basic_string.h.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="basic_string.h.patch"

LS0tIGJhc2ljX3N0cmluZy5oLm9yaWcJMjAxOC0wNS0wMyAwNjoyMjo0Ni4w
MDAwMDAwMDAgKzAyMDAKKysrIGJhc2ljX3N0cmluZy5oCTIwMTgtMDYtMTIg
MTU6NTY6MDMuMjE1MTc5MzAwICswMjAwCkBAIC02MzI5LDE4ICs2MzI5LDYg
QEAKICAgICB7IHJldHVybiBzdGQ6OmdldGxpbmUoX19pcywgX19zdHIpOyB9
CiAjZW5kaWYKIAotICB0ZW1wbGF0ZTw+Ci0gICAgYmFzaWNfaXN0cmVhbTxj
aGFyPiYKLSAgICBnZXRsaW5lKGJhc2ljX2lzdHJlYW08Y2hhcj4mIF9faW4s
IGJhc2ljX3N0cmluZzxjaGFyPiYgX19zdHIsCi0JICAgIGNoYXIgX19kZWxp
bSk7Ci0KLSNpZmRlZiBfR0xJQkNYWF9VU0VfV0NIQVJfVAotICB0ZW1wbGF0
ZTw+Ci0gICAgYmFzaWNfaXN0cmVhbTx3Y2hhcl90PiYKLSAgICBnZXRsaW5l
KGJhc2ljX2lzdHJlYW08d2NoYXJfdD4mIF9faW4sIGJhc2ljX3N0cmluZzx3
Y2hhcl90PiYgX19zdHIsCi0JICAgIHdjaGFyX3QgX19kZWxpbSk7Ci0jZW5k
aWYgIAotCiBfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX1ZFUlNJT04KIH0gLy8g
bmFtZXNwYWNlCiAK


--------------2919FF0A3B0A158CCF9BFF23
Content-Type: text/plain; charset=us-ascii


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019