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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=c4zOH6RDGuP9wIY6
	J8HL78fX6VknG1/M7yMtbyGl11CDGrcy/+f4wM+a1V3vKM0EIGiPYRRSpAWmxr1r
	K/phNSKw7ZszfX3WKd4So+UhcQTvdy8avooEzUSwug18KJPIuq0QByXAaEoc2Jtb
	ljFBnrjrR4xOWZUcVTV6WkH2hiE=
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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=K/cWGJsZxAzl2XIkdJQBmr
	sNw4g=; b=DWEIINE/XmA/71JPXHzgUyQuZ/S5rEiNljQnyLLdR7HpZYczut8Rg1
	oZq5LttlsDN3jxwghgGi2CPfBtYBImOPFIfldSk7xeFo7a97CmwlKgbE+i0GDlAE
	KTX6pYbJekYmKmQozC1QXNd0UrDEUckVt558fLE2QYkdSI8mpvrFc=
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=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=extracts, Extracts, Ross, HContent-Transfer-Encoding:8bit
X-HELO: mail-wr0-f180.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:subject:to:references:from:message-id:date         :user-agent:mime-version:in-reply-to:content-language         :content-transfer-encoding;        bh=PR+wRGZ1jDO2YKrOy/yZcOAm4Ybf8UXGxWX9ajDJP1Q=;        b=C02FsLO2rIroIW+kKqpZhyKABld1GuReAsT2bO36Plyk5H994/qU3huuhy8gXC49y4         n7v9DuuwGxhe1TQ0Z0hohioi1cCFNDxurjcbh6T9PqJU3+uSsVJQkqk4cD+5PaLBVQtL         lhH2xu2RP/EL2a8S/OF0m5a00GascM4qSe+JaeG7Chx5q3izLOiAW9svG37kTyLq2fCm         XU80w6amjVS8MCihVb4FhcUcD0czaeA6iI9g/XWJsyePfJ1tqCsSmBBcWQaMlvhYCwp8         aKyreSwbIHdKmDmm+gH8XjUClfJk+7uKvUUCJr3D3b2Ve6A8XrxQZ1cuom/7uyAGaCz6         +DKw==
X-Gm-Message-State: APt69E3nUKmbhN//5Ze7zS9u4Wv+zOqfI5GFy9azZIuTRU2RrodWtczg	xp8wc4oUKxdX1y5qFZLHKhjz0b+U
X-Google-Smtp-Source: ADUXVKJU4nYOeVduXgeL6LQZhm/l3o1mEj7AK6cOGQEKrbEZjekuRQly7uSYfLbmYEsa+lkbiAIvjA==
X-Received: by 2002:adf:e48e:: with SMTP id i14-v6mr14316237wrm.8.1528726640511;        Mon, 11 Jun 2018 07:17:20 -0700 (PDT)
Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream
To: cygwin@cygwin.com
References: <CAHVoUt2pHP46o6ERwx9HB5=Dn-J9xv5i-53RYtJbdev-K9DCeQ@mail.gmail.com> <a7b8e684-f985-f8f2-c7f2-79e618e8ece1@gmail.com> <0d0d9dc4-5cce-724a-6fb2-7bf0a5a71db4@otoy.com>
From: Marco Atzeri <marco.atzeri@gmail.com>
Message-ID: <1e9791c0-fbc9-6507-58bc-6864ae65c967@gmail.com>
Date: Mon, 11 Jun 2018 16:17:19 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
MIME-Version: 1.0
In-Reply-To: <0d0d9dc4-5cce-724a-6fb2-7bf0a5a71db4@otoy.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes
Note-from-DJ: This may be spam

On 6/11/2018 4:11 AM, Ross Smith wrote:
> On 2018-06-06 09:00, Marco Atzeri wrote:
>> On 6/5/2018 10:32 PM, Ivan Shynkarenka wrote:
>>>   Hello
>>>
>>> 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
>>
>> works fine on 32 bit and 64 bit on my W7
> 
> I'm having the same problem. My test program:
> 
> #include <fstream>
> #include <iostream>
> int main() {
>      std::ifstream in("demo.cpp");


with this change does not segfault

   std::ifstream stream("demo.cpp\n");

function <string> std::getline (string)

Get line from stream into string
Extracts characters from is and stores them into str until the 
delimitation character delim is found (or the newline character, '\n', 
for (2)).


>      std::string line;
>      for (;;) {
>          std::getline(in, line);
>          if (! in && line.empty())
>              break;
>          std::cout << line << "\n";
>      }
> }
> 
> $ g++ demo.cpp -std=c++17 -o demo && ./demo
> Aborted (core dumped)

./demo.exe



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

