From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69289 invoked by alias); 11 Jun 2018 14:17: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 68740 invoked by uid 89); 11 Jun 2018 14:17:24 -0000 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 Received: from mail-wr0-f180.google.com (HELO mail-wr0-f180.google.com) (209.85.128.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Jun 2018 14:17:23 +0000 Received: by mail-wr0-f180.google.com with SMTP id f16-v6so20604531wrm.3 for ; Mon, 11 Jun 2018 07:17:22 -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: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) Received: from [172.21.192.166] ([178.15.39.162]) by smtp.gmail.com with ESMTPSA id h77-v6sm10977234wmd.9.2018.06.11.07.17.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 07:17:19 -0700 (PDT) Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream To: cygwin@cygwin.com References: <0d0d9dc4-5cce-724a-6fb2-7bf0a5a71db4@otoy.com> From: Marco Atzeri Message-ID: <1e9791c0-fbc9-6507-58bc-6864ae65c967@gmail.com> Date: Mon, 11 Jun 2018 20:38:00 -0000 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 X-SW-Source: 2018-06/txt/msg00116.txt.bz2 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 >>> #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 >> >> works fine on 32 bit and 64 bit on my W7 > > I'm having the same problem. My test program: > > #include > #include > int main() { >     std::ifstream in("demo.cpp"); with this change does not segfault std::ifstream stream("demo.cpp\n"); function 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