From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11686 Path: news.gmane.org!.POSTED!not-for-mail From: Bartosz Brachaczek Newsgroups: gmane.linux.lib.musl.general Subject: Re: Documentation of memcpy and undefined behavior in memset Date: Thu, 6 Jul 2017 21:05:12 +0200 Message-ID: <98d2e82c-1930-5dc2-2afa-bf6f4c9a8a50@gmail.com> References: <0F9B48AD-C5B3-44B6-8D82-0985CF8604A0@trust-in-soft.com> <20170706162353.GC1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1499367929 25669 195.159.176.226 (6 Jul 2017 19:05:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 6 Jul 2017 19:05:29 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: musl@lists.openwall.com Original-X-From: musl-return-11699-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 06 21:05:25 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dTC5b-0006NI-Lw for gllmg-musl@m.gmane.org; Thu, 06 Jul 2017 21:05:23 +0200 Original-Received: (qmail 28643 invoked by uid 550); 6 Jul 2017 19:05:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28622 invoked from network); 6 Jul 2017 19:05:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=/0wl51ikUyzcGlCXvS3FPjkW0OmBhGQHPvOlN9qtmnk=; b=eJJ4e6gC5eruQ8Sal/zluka6iSjAmp4TFws+3dgGH7hZLBWULqPpnWi9cnbaCXyGcN bPgOnvAW0yfjuPWomjoMkBMMhga2n0b/KxueGhNbDc5/CLnsyYqg7aVr6T0UZgaKA6NY KZPY9C+aD4YyEfil+OKG3w57GczfiRTj0sulh6tq37vSvUvX0Ul4E+bFRk/bEQaRk1SP CwL/ETa8SJdNAq/tk41Jc1OsH68MLu6KUe1kAPCOwbzLFa8WJo+TBoa/dHSVoEhhnieT KhHdv0cDwI5y6+qDUrFKEKnP3CMNbaPKKcC0qWqmJGpuFDevPWOLahqm99NwoTWuHKnQ a4zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/0wl51ikUyzcGlCXvS3FPjkW0OmBhGQHPvOlN9qtmnk=; b=aMEcK1WbEnhNceo47+W8GVdiF0n0g/xYjdhiowjBL0V2WClcA23ZEbl4w090NShHuh YQK69Pl3AR6Q6pQiAyG3EhWm+AcK63OLVk7Zc8+ctA99ZpYsjOU6BsmyhsTbLhoVZ3IV dq3NNeZJSYOBYuxhY4j8+fJkBYTYRb1aWUY7N421veatnGuMus9Pu5Ijk7In9iQf6WZV RuSEWfpqDigdMCU12PV+cqmlptWzUhH0TWiKcSm4EJcN9z4rFQAtPepXrbNiuyP5CFnx xg0rukxapjjN5DfjHOr9v8pagkKb8jRaI8zYWc+WyIL/aSEsK0bHX1ku4nEK+HFvQstS pNww== X-Gm-Message-State: AIVw113qR3U6f/CWAo2RaTeATye1WrE4wG9qRo1fF/X9nqoPXckzjJaW ayZgfuR6Zm06SvGg5uM= X-Received: by 10.98.204.23 with SMTP id a23mr27582403pfg.59.1499367914138; Thu, 06 Jul 2017 12:05:14 -0700 (PDT) In-Reply-To: <20170706162353.GC1627@brightrain.aerifal.cx> Content-Language: en-US Xref: news.gmane.org gmane.linux.lib.musl.general:11686 Archived-At: On 7/6/2017 6:23 PM, Rich Felker wrote: > I think you're correct, at least under a pessimistic interpretation of > the standard. I can't find where they actually define "modifies", and > you could argue that assignment of the same value twice "modifies" the > object at most once, but I don't like relying on that kind of > ambiguity and it's easy enough to fix just by adding a sequence point. I don't have a copy of C11, but N1570 reads in a note to 3.1: > ‘‘Modify’’ includes the case where the new value being stored is the same as the previous value. Bartosz