From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id D80A13858C2D for ; Mon, 27 Nov 2023 19:39:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D80A13858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D80A13858C2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701113987; cv=none; b=ph6aG167rURCpKrwhcrYlQmmsCKpmsirk6nb+//QHtfvrvmmN1No07rsb3j3fHRM1RWZmX3j2Yu8s25vcerk4Qbon80s8BgIe+bHU0rjv2c5926AOAOe4eskQjFJ5Kt6pqqVv9N8lhw0j8M922xSGQqjeRdgPylAOnH7vwBlzKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701113987; c=relaxed/simple; bh=dkKFtRvwqW7Kct7afmq7Z2cJ+5WtP86Hr5fYgsBAV/M=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=e8s0Um8OKz5TNSr208UO1hL0bQkhN1LDij6EpsbEQVYJfbQOOhRb65kSsnxU6qD6MASJFT6MWajMsqnlzOla1LtJVlo/fBiuaPkg55gObo0H5D3WgSSZ9u+n4DcvD6sC++cBAZ3t7oHBdUV4VyiTampluFK2ZSIOSybLHmCRJA0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 29CC63C011BDD; Mon, 27 Nov 2023 11:39:46 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LdIFNB5VDCwT; Mon, 27 Nov 2023 11:39:45 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id D88CE3C011BDC; Mon, 27 Nov 2023 11:39:45 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu D88CE3C011BDC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1701113985; bh=MNRbHLqqbF+DojlbahjH6rBHzu9NTA2EiT7+PlC9kVo=; h=Message-ID:Date:MIME-Version:To:From; b=LrWYtsLe/OgEV8EqyCg1+8IBb33NFfeYDaTo5XguyTyCOe9f/uX4Sr7kdg5cRklpw nEBtf9MU461j1Nzc9Yhbx2Yql84jb+HGQDNPvKWsfVv/xagosEpjprydTDP1ceeJhB JvQc6hhIEVJZUTsQH5BZqbJgWEHQ0NthvEFgbRS5xkANWTrix3OfL2S1287YWt7MXU qRRrXCwqQSCdbuJPHKz6LTWUPMKLBEyCPyZXQA53Spiup7TetFUnigE4eQSmjvmM6c xYcLrS1CS/0gDcreLgJxd339Y/pG+xQtOyy8BXpY0mlUllqZCxK8i3PD4xASUtPNVr vmd8YhwxWVzjA== X-Virus-Scanned: amavisd-new at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AQPinWsGgMaj; Mon, 27 Nov 2023 11:39:45 -0800 (PST) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id A546C3C011BDD; Mon, 27 Nov 2023 11:39:45 -0800 (PST) Message-ID: <5cc4d726-96a7-4560-aa15-738c78209c1e@cs.ucla.edu> Date: Mon, 27 Nov 2023 11:39:45 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Support for memcpy with equal source and destination Content-Language: en-US To: Aaron Peter Bachmann , libc-alpha@sourceware.org References: <626f0faf-dc80-4147-8463-cd2f5905c038@inode.at> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <626f0faf-dc80-4147-8463-cd2f5905c038@inode.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham 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 2023-11-27 11:28, Aaron Peter Bachmann wrote: > a conforming compiler could just remove the test No, because the standard does not allow the compiler to assume that two pointers are unequal merely because both are restricted. It merely allows the compiler to assume that the two pointers are unequal if both are dereferenced and at least one is used to modify the object. Which is not the case when "dest != src" is executed. The situation is like "if (n != 0) return m/n;". Obviously m/n has undefined behavior when n is zero. But the compiler cannot use this information to optimize away the "n != 0" test.