From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27670 invoked by alias); 21 Sep 2016 20:42:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 27644 invoked by uid 89); 21 Sep 2016 20:42:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1170 X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH] libio: Add small optimization on fmemopen To: Florian Weimer , Adhemerval Zanella , libc-alpha@sourceware.org References: <1474466758-26544-1-git-send-email-adhemerval.zanella@linaro.org> <2afbe144-bb78-b657-002a-361fb3220269@cs.ucla.edu> <03eb21f7-6979-62eb-0fe8-34ea35b0c7d6@linaro.org> <708fc89d-fbb9-cb20-9ee6-079013baf63b@redhat.com> <6beed9ba-f675-4860-9070-76b7afa31654@cs.ucla.edu> From: Paul Eggert Message-ID: <75d20743-1717-be01-8b6d-26cdb33f012b@cs.ucla.edu> Date: Wed, 21 Sep 2016 20:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-09/txt/msg00436.txt.bz2 On 09/21/2016 12:27 PM, Florian Weimer wrote: > _Alignas is used only to demonstrate the issue more clearly. > That's not clear to me. Yes, _Alignas does make the issue pop out more. However, the problem with the proposed fmemopen code has to do with allocating flexible arrays via malloc (a fairly common practice), whereas the problem illustrated by GCC bug 66661 comment 12 has to do with static allocation of flexible array members (a rarely used feature). As I understand it, comment 12 argues that GCC should not be able to assume that an object's size is a multiple of its alignment. That's a steep uphill climb, I'm afraid, as GCC is riddled with that assumption, it would be painful to remove it, and the resulting benefit would be so trivial that I'm afraid it would not be worth the effort. If there's a bug in the abovementioned rarely used feature, surely it can be fixed without having to alter GCC's fundamental assumption that size is a multiple of alignment. > glibc currently does not compile with Address Sanitizer anyway It's not just Address Sanitizer, right? valgrind has a similar issue.