From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75595 invoked by alias); 12 Jun 2018 20:32:25 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 75585 invoked by uid 89); 12 Jun 2018 20:32:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:r21-v6s, HX-HELO:sk:mail-pg, H*r:sk:mail-pg X-HELO: mail-pg0-f46.google.com Received: from mail-pg0-f46.google.com (HELO mail-pg0-f46.google.com) (74.125.83.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Jun 2018 20:32:23 +0000 Received: by mail-pg0-f46.google.com with SMTP id r21-v6so120061pgv.4 for ; Tue, 12 Jun 2018 13:32:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:newsgroups:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TEkNr+0TqRNqbjAUSqzcLhNtFGMgwler7s5ftFBj0XY=; b=c0GTWC2k5GeLNP96OIg+0csTVeOZ6SU8BJyZXGbcD3SQtwyfuOuDP5CixYDwllx0pH xKZW7yccelpdPEtYj74kMFnNy/fI+YAlljGbnhVgkA4OxFpzV4gBSMKBxtajYn1lGV8s NUKzEcdY2CGH9cPXEiR3Vr5NlNM4bEYYL6JQC4FM027520D+15MVfdYeupyiu3bVIVFS h81Ot2ukX3rsJcYSe5W44MfOis1xLpTmcdeiUbDjuIPAdJz4kGJrUajXiiBYEPk/uFXj KkoPZGL7GIzwSBKphZeqDZl32QxDl9ApEpGc2XQnKOs40DR2HTm6swmhiCcf4HYGUvRY hnBg== X-Gm-Message-State: APt69E0r95ZTJKWmTgPZ/cZk0fQo7zRfa1WZgU7q6zCKlQNM4rFQsBNO CQE0Pm/EFi241/QeSSpk2gynEVA= X-Google-Smtp-Source: ADUXVKIXycApSqhluLR4KZ8tDFDDj6diKV6Tw097Qsm4tJG5+q9eXXvEYHPNUef8RXtdYoSd52BBSg== X-Received: by 2002:a63:3e83:: with SMTP id l125-v6mr1602213pga.355.1528835541532; Tue, 12 Jun 2018 13:32:21 -0700 (PDT) Received: from [10.0.0.87] (125-236-198-58.adsl.xtra.co.nz. [125.236.198.58]) by smtp.gmail.com with ESMTPSA id a11-v6sm974793pgq.32.2018.06.12.13.32.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 13:32:20 -0700 (PDT) Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream To: cygwin@cygwin.com Newsgroups: gmane.os.cygwin References: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> From: Ross Smith Message-ID: <25a7729c-7d4c-ee3a-6656-4f6d6932a164@otoy.com> Date: Wed, 13 Jun 2018 00:44:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2018-06/txt/msg00131.txt.bz2 On 2018-06-13 05:11, Christian Franke wrote: > 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 >> #include >> >> 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 Thank you! I can confirm that the patch fixes this. Ross Smith -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75851 invoked by alias); 12 Jun 2018 20:32:27 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 75737 invoked by uid 89); 12 Jun 2018 20:32:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*r:Unknown, you!, HContent-Transfer-Encoding:8bit X-HELO: blaine.gmane.org Received: from Unknown (HELO blaine.gmane.org) (195.159.176.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Jun 2018 20:32:25 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fSpve-0004OQ-TS for cygwin@cygwin.com; Tue, 12 Jun 2018 22:30:10 +0200 To: cygwin@cygwin.com From: Ross Smith Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream Date: Wed, 13 Jun 2018 03:05:00 -0000 Message-ID: <25a7729c-7d4c-ee3a-6656-4f6d6932a164@otoy.com> References: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 In-Reply-To: <0725bdbd-0411-138a-7ea9-d6395e3256e3@t-online.de> X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00132.txt.bz2 Message-ID: <20180613030500.JjdvnkIjJapvoJLAD3fVx5CKPQmpzK-rUfGP12AN1bA@z> On 2018-06-13 05:11, Christian Franke wrote: > 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 >> #include >> >> 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 Thank you! I can confirm that the patch fixes this. Ross Smith -- 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