From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95830 invoked by alias); 6 Sep 2016 21:41:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 95812 invoked by uid 89); 6 Sep 2016 21:41:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,URIBL_RED autolearn=no version=3.3.2 spammy= X-HELO: mail-oi0-f52.google.com Received: from mail-oi0-f52.google.com (HELO mail-oi0-f52.google.com) (209.85.218.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Sep 2016 21:41:29 +0000 Received: by mail-oi0-f52.google.com with SMTP id s131so58896439oie.2 for ; Tue, 06 Sep 2016 14:41:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GuUPFcR04cA0FBsgTyBgbIGoQmx93UHXd4C7vKNFTYY=; b=BHKb2XuVSFIZQuFNqOfkNm4bBjKLWgdriU3nZsqlaBP7o05lvu8p64J2G/1DzRJf19 c5qgQb0TmR/h6p61K/OlVGrGHlWK4Pcuo29chKfv4yxuMhidQm5LPAFl1/HVG9boIdfA l8pVEbwGcHiqizJ3uaRfED9gecQspQvmtn21PdC0/PIUgIIIywm8vjSE/OVt8VEW+uwj BGp+K6AwcBBSgYno0qjI8tZu1aRek4ETI0gUBrRV6duE5+NOUExKIXcjWtBDLaz8VXoZ nxFTrKsZIRKX8VGv+4PLVGiR058rQoUCLyDRanIkUF2ZBhPhBisrIbm4dI550DYASrQW bYiw== X-Gm-Message-State: AE9vXwMkbh/4KZnabxxTC/HroqNRe/hoHMXvwszmemZgUehF5AuQ6LDCIrFL49DEmn5utda2BLq4U6/kq4CQGj0g X-Received: by 10.157.47.230 with SMTP id b35mr1871378otd.90.1473198087690; Tue, 06 Sep 2016 14:41:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.105.169 with HTTP; Tue, 6 Sep 2016 14:41:07 -0700 (PDT) In-Reply-To: References: <3bb7530e-fff4-6030-a87e-1654d55d1e45@redhat.com> From: Jason Merrill Date: Tue, 06 Sep 2016 21:53:00 -0000 Message-ID: Subject: Re: Make max_align_t respect _Float128 [version 2] To: Joseph Myers Cc: Florian Weimer , gcc-patches List , eggert@cs.ucla.edu Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00348.txt.bz2 On Tue, Sep 6, 2016 at 5:03 PM, Joseph Myers wrote: > On Tue, 6 Sep 2016, Jason Merrill wrote: > >> On Tue, Sep 6, 2016 at 11:16 AM, Joseph Myers wrote: >> > GCC is supposed to support all mallocs that produce results aligned to at >> > least MALLOC_ABI_ALIGNMENT (which may be smaller than the alignment of >> > max_align_t). >> >> I've just been running into problems with MALLOC_ABI_ALIGNMENT being >> smaller than max_align_t, which doesn't make sense to me; the C11 >> passage Florian quoted says that malloc needs to support all >> fundamental alignments, i.e. max_align_t. > > The point is that GCC supports being used in nonconforming implementations > as well as in conforming ones, and in nonconforming contexts people may > e.g. interpose malloc with a version that yields sufficient alignment for > common cases but may not use 16-byte alignment, or may not align small > objects as much as larger ones (whereas ISO C requires all alignments, > even 1-byte ones, be aligned as much as max_align_t). MALLOC_ABI_ALIGNMENT is documented as "Alignment, in bits, a C conformant malloc implementation has to provide," which doesn't sound like it's intended to allow for non-conforming implementations. And doesn't a smaller default lead to lost optimization opportunities in the typical case? The reason I care is that C++17 aligned new (wg21.link/p0035) specifies that for types that require more alignment than the usual operator new provides, the new-expression instead calls an operator new with an explicit alignment parameter. MALLOC_ABI_ALIGNMENT sounded like exactly what I was looking for, but then I noticed that 'new long double' was going to the aligned new operator, which breaks older code that replaces operator new (without, of course, replacing the aligned variant). Jason