From owner-freebsd-toolchain@freebsd.org Wed Mar 13 11:57:45 2019 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AC79152FE32 for ; Wed, 13 Mar 2019 11:57:45 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from smtp.digiware.nl (smtp.digiware.nl [IPv6:2001:4cb8:90:ffff::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5353741ED for ; Wed, 13 Mar 2019 11:57:44 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router.digiware.nl (localhost.digiware.nl [127.0.0.1]) by smtp.digiware.nl (Postfix) with ESMTP id 9DFD21A5C7; Wed, 13 Mar 2019 12:57:36 +0100 (CET) X-Virus-Scanned: amavisd-new at digiware.com Received: from smtp.digiware.nl ([127.0.0.1]) by router.digiware.nl (router.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WLXFTp2kQrXg; Wed, 13 Mar 2019 12:57:36 +0100 (CET) Received: from [192.168.10.9] (vaio [192.168.10.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.digiware.nl (Postfix) with ESMTPSA id 1776F1A5C6 for ; Wed, 13 Mar 2019 12:57:36 +0100 (CET) To: FreeBSD Toolchain From: Willem Jan Withagen Subject: Is this a programming error, or a compiler error.. Message-ID: Date: Wed, 13 Mar 2019 12:57:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: nl X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2019 11:57:45 -0000 Hi, I'm getting a crash in a Ceph test program in the following pice of code: struct entity_addrvec_t {   vector v; .....   entity_addr_t legacy_addr() const {     for (auto& a : v) {       if (a.type == entity_addr_t::TYPE_LEGACY) {         return a;       }     }     return entity_addr_t();   } ...... Where the loop is taken, even if v.size() == 0 So v content is pointing to random memory and itterating over the next pointer results in a crash. I would expect the loop not to be executed.... --WjW