From owner-freebsd-toolchain@freebsd.org Wed Mar 13 12:17:07 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 772451531884 for ; Wed, 13 Mar 2019 12:17:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 108F975232 for ; Wed, 13 Mar 2019 12:17:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.1.32] (92-111-45-98.static.v4.ziggozakelijk.nl [92.111.45.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E3485577B9; Wed, 13 Mar 2019 13:17:05 +0100 (CET) From: Dimitry Andric Message-Id: <98EFC560-16A0-4F62-892A-64B15B21AF21@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: Is this a programming error, or a compiler error.. Date: Wed, 13 Mar 2019 13:17:05 +0100 In-Reply-To: Cc: FreeBSD Toolchain To: Willem Jan Withagen References: X-Mailer: Apple Mail (2.3445.102.3) 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 12:17:07 -0000 --Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 13 Mar 2019, at 12:57, Willem Jan Withagen wrote: >=20 > I'm getting a crash in a Ceph test program in the following pice of = code: >=20 > struct entity_addrvec_t { > vector v; > ..... > entity_addr_t legacy_addr() const { > for (auto& a : v) { > if (a.type =3D=3D entity_addr_t::TYPE_LEGACY) { > return a; > } > } > return entity_addr_t(); > } > ...... >=20 > Where the loop is taken, even if v.size() =3D=3D 0 > So v content is pointing to random memory and itterating over the next = pointer results in a crash. This can happen when the vector is invalidated, due to either it, or its parent object having been moved from. Maybe run this under valgrind or AddressSanitizer, that should give some more clues. -Dimitry --Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXIj0wQAKCRCwXqMKLiCW ozqNAKCdU6u26/t8zJLS6lt9XN6rhNMuAQCcD0aDm8mbqvYO0GvUu7gQl6EKZak= =1mrP -----END PGP SIGNATURE----- --Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF--