From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92386 invoked by alias); 5 May 2017 09:51:35 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 92365 invoked by uid 89); 5 May 2017 09:51:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=HTo:D*at, H*R:D*gnu.org, H*R:D*gcc.gnu.org, H*M:2389 X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 May 2017 09:51:31 +0000 Received: from 187.57.140.77.rev.sfr.net (HELO stedding) ([77.140.57.187]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2017 11:51:31 +0200 Date: Fri, 05 May 2017 09:51:00 -0000 From: Marc Glisse Reply-To: gcc@gcc.gnu.org To: Helmut Zeisel cc: gcc@gcc.gnu.org Subject: Re: Bug in GCC 7.1? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT X-SW-Source: 2017-05/txt/msg00052.txt.bz2 (I think you are looking for gcc-help@gcc.gnu.org, or gcc's bugzilla, rather than this mailing list) On Fri, 5 May 2017, Helmut Zeisel wrote: > The following program gives a warning under GCC 7.1 (built on cygwin, 64 bit) > > #include > int main() > { > std::vector c {1,2,3,0}; > while(c.size() > 0 && c.back() == 0) > { > auto sz = c.size() -1; > c.resize(sz); > } > return 0; > } > > $ c++7.1 -O3 tt.cxx Please use $ LC_ALL=C c++7.1 -O3 tt.cxx when you want to post the result, unless you are sending to a German forum. > In Funktion »int main()«: > cc1plus: Warnung: »void* __builtin_memset(void*, int, long unsigned int)«: angegebene Größe 18446744073709551612 überschreitet maximale Objektgröße 9223372036854775807 [-Wstringop-overflow=] > > Compiling with GCC 6.1 (c++6.1 -O3 tt.cxx) works fine. > > Is this a problem of my program or a problem of GCC 7.1? Sounds like a problem with gcc, maybe optimization creates a path that corresponds to size==0 and fails to notice that it cannot be taken. -- Marc Glisse