From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 74166388A032 for ; Mon, 3 Jun 2024 16:20:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74166388A032 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74166388A032 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717431653; cv=none; b=STJrHu8/2B6IXTq3wRTudSNet4dCofnbsC8SLZiOPBXIsLQ9eDqzkIDM6OY5FjMfRBeVN0zqi8k3rB2q/p+lSd2gV3V/UyzExCBgZN34rQCjLOuc2Yd12Szi/Cir9G76SMiMzNx0JNvX60+VPjE70D3vII/a385trvV1qK10BVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717431653; c=relaxed/simple; bh=mVvs8ycDPWSXBL8FBxQaov0y4f01zJacLttPT08nTFE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=g5ASq49M6M3BDrOhKQCY8c4r5vZwANrlFXfXtRQE8kb9MHRRrV5H15x+WB+jv3dMFzpTZaFZUOl5FnUcEI8AHxdV+CpP+aZb5CH0ZsEk//5L8joY6Oo+5omzwnTauHam7PQjZ/9AjzM0VppuGotufbQHgGF5hLXot2Ezgkc7GE8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717431651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7jVPhhKSu8kOiE0JSqMycZuhyPaV9xYjnEENDEx024E=; b=Al8ZhUUqpUMU2OBJGIshK/7RFSe8DhaHzHaI8Oy+Zws0PaFxqQeBC+H2GOBlQn4mcVfLEx zFYFQLiRMxMvrkCXtamSkaGFxW6IS8ttVL2Zk/sB/7ktgYO2Z9ISlOuLL4uabgli8XUCPa eh/WHXI85lsST+Q8gaUN2ZwtJFH9Azs= Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-C8FN7060MDCjeMbqtAEdfA-1; Mon, 03 Jun 2024 12:20:49 -0400 X-MC-Unique: C8FN7060MDCjeMbqtAEdfA-1 Received: by mail-yb1-f197.google.com with SMTP id 3f1490d57ef6-dfa74682897so4806475276.2 for ; Mon, 03 Jun 2024 09:20:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717431647; x=1718036447; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7jVPhhKSu8kOiE0JSqMycZuhyPaV9xYjnEENDEx024E=; b=qd7ali+Uts62cyR2zDdh70gALdr6GKSJG2fvtt/QyWFUSYfIARICVKbSC4+kNfAnIw jXAHzmz+XTFLOXXY3d/p5Pl1gv1LGtRFLLiamntCU92eh9npWzqD4ud3Pyc0NYsBEYkd zy4rshAZsyx+u8cUQt1SiVlqvrSviYGb6C6U1853+OLeQ6IZQEtdla/SYeAouGBIWlJf 7krE/AH687tU4l7WFrwUNdI0WQyfgeHGg04QTEv85Zzpby8iUFLOOyV/MUC0OM4rWPLl 21qYivbe5936lgV0yolUtnIiJTUVCMQyTjuKK1YOnZCFU4FRsNx3+UZDzKuTaQ4ZXYht WLZw== X-Gm-Message-State: AOJu0YxDtKzY8KN0Yd8exJGIu92CnLNO1nngpe2izOz+JBP1ntxwKmH7 kwjwMNSpazBVEKvnS7uzbvCDRir0gMVNlGXpx5bjJ6zystd+s3oCqkRpKDzZYlz+jCyZLTb+Y5D Z8yvreCY4IPldJ5V0EL/hevDQAG8hNhZb2DfO808oukcjfjQFhnN0ORshmKf3pyUtY5hBqlLyoA PJGUwfZQs+N30uZXau/cGiImfky/A= X-Received: by 2002:a25:bc85:0:b0:dee:6525:7424 with SMTP id 3f1490d57ef6-dfa73c13b4dmr8672451276.25.1717431647579; Mon, 03 Jun 2024 09:20:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFG+GBsvnDCp1r+1fjS09RWL/9nDPpva9IL6cG5VUFcC4m3H8WgpZVFW8VuOFeg2zTk8tDJA8cZxhCB5g0SEM= X-Received: by 2002:a25:bc85:0:b0:dee:6525:7424 with SMTP id 3f1490d57ef6-dfa73c13b4dmr8672436276.25.1717431647203; Mon, 03 Jun 2024 09:20:47 -0700 (PDT) MIME-Version: 1.0 References: <4657346e-3046-424a-be1d-32a7eaecae32@gmail.com> In-Reply-To: From: Jonathan Wakely Date: Mon, 3 Jun 2024 17:20:31 +0100 Message-ID: Subject: Re: [PATCH] Fix -Wstringop-overflow warning in 23_containers/vector/types/1.cc PR109849 To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 3 Jun 2024 at 05:56, Fran=C3=A7ois Dumont wr= ote: > > I hadn't try to make my patch as limited as possible to fix the problem, > indeed. > > libstdc++: Fix -Wstringop-overflow warning coming from std::vector > [PR109849] > > libstdc++-v3/ChangeLog: > > PR libstdc++/109849 > * include/bits/vector.tcc > (std::vector<>::_M_range_insert(iterator, _FwdIt, _FwdIt, > forward_iterator_tag)): Add __builtin_unreachable > expression to tell > the compiler that the allocated buffer is large enough to > receive current > elements plus the range to insert. > > Tested under Linux x64, ok to commit ? Does the !__builtin_constant_p(__len) in this version do anything? If it's a constant, then the compiler can already provide it's in range, so the __builtin_unreachable() is redundant, but doesn't do any harm.