From owner-freebsd-current@freebsd.org Tue Jul 5 20:14:35 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70198B71669 for ; Tue, 5 Jul 2016 20:14:35 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F61918CD; Tue, 5 Jul 2016 20:14:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f41.google.com with SMTP id j185so59585124ith.0; Tue, 05 Jul 2016 13:14:34 -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:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=fq2JjJ9FFDGn0gXtlpuADYU8alB82GVLLAXQ6+DZhSE=; b=hxXDy6OU+BtyKX7Wl/hsVJLKjXfq6D5sMp4Zgy2PvJKqmOUhrF6ybjMXO61aeCa/iP h5ccUCQFJpyV52oHg119kvP30yjqUqUwSB4ExHVF6DfnVBlk0vTBQ3f47XDeH2lvANji zw73LFrxrmRXIwmpTrrRT9+YUNQ1O/MiZazNdp/lrPtIx15GlhmHadtKGux0Jtutome5 5WICxdJiFRpuvfdJxUAgRvgVYe3sWDZE1Cw/actKtXRQMuO5PA6DxhfccqHDJdcBEEUq 0P+GVzpPap8GqG0HX7nUM01Nu/ixzAKZ/KYOJrSBHI2dEIhf1w3TPTInc/NmqP39AjVZ Ih7A== X-Gm-Message-State: ALyK8tIXQ/VG86YllBLFSSb0ST4e7BLlF/i5W9du44/Qb/BNsLNzF9WskBPuPR8Xkv0y0w== X-Received: by 10.36.10.204 with SMTP id 195mr15550519itw.93.1467749673898; Tue, 05 Jul 2016 13:14:33 -0700 (PDT) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com. [209.85.223.172]) by smtp.gmail.com with ESMTPSA id u135sm1562217ita.21.2016.07.05.13.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jul 2016 13:14:33 -0700 (PDT) Received: by mail-io0-f172.google.com with SMTP id f30so183484789ioj.2; Tue, 05 Jul 2016 13:14:33 -0700 (PDT) X-Received: by 10.107.182.136 with SMTP id g130mr15647399iof.27.1467749673389; Tue, 05 Jul 2016 13:14:33 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.206.2 with HTTP; Tue, 5 Jul 2016 13:14:33 -0700 (PDT) In-Reply-To: <838A69F7-343D-4398-928B-E54FB966B574@gmail.com> References: <838A69F7-343D-4398-928B-E54FB966B574@gmail.com> From: Conrad Meyer Date: Tue, 5 Jul 2016 13:14:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: clang 3.3/3.4 fails to build items that use stdlib.h because of __alloc_size attribute assigned to posix_memalign To: "Ngie Cooper (yaneurabeya)" Cc: Dimitry Andric , Roman Divacky , Pedro Giffuni , FreeBSD current Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 20:14:35 -0000 Whoops, missed reply-all the first time. It seems pretty clear that alloc_size (return value is a memory allocation of size from parameter N) does not apply to posix_memalign, because posix_memalign's allocation is stored via a pointer argument rather than return value. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-F= unction-Attributes IMO the attribute should be removed from posix_memalign in stdlib.h Best, Conrad On Tue, Jul 5, 2016 at 1:07 PM, Ngie Cooper (yaneurabeya) wrote: > Hi, > It looks like clang 3.3/3.4 from ports both don=E2=80=99t like __= alloc_size being attached to posix_memalign. This only concerns me because = it might make the src upgrade path from 9.3/10.3 to 11.0 painful. > Thoughts on how this should be fixed or whether or not we care? > Thanks, > -Ngie > > $ cd usr.sbin/bhyve; make clean; script ts make all CC=3Dclang34 > ... > In file included from /usr/src/svn/usr.sbin/bhyve/atkbdc.c:40: > /usr/include/stdlib.h:176:6: error: '__alloc_size__' attribute only appli= es to functions that return a pointer [-Werror,-Wignored-attributes] > __alloc_size(3); /* (ADV) */ > ^ > /usr/include/sys/cdefs.h:241:40: note: expanded from macro '__alloc_size' > #define __alloc_size(x) __attribute__((__alloc_size__(x))) > ^ > 1 error generated. > *** Error code 1 > > Stop. > make: stopped in /usr/src/svn/usr.sbin/bhyve > $ (set -x; clang33 --version; clang34 --version) > + clang33 --version > clang version 3.3 (tags/RELEASE_33/final) > Target: x86_64-portbld-freebsd11.0 > Thread model: posix > + clang34 --version > clang version 3.4.2 (tags/RELEASE_34/dot2-final) > Target: x86_64-portbld-freebsd11.0 > Thread model: posix > > 282988 pfg int posix_memalign(void **, size_t, size_t) __nonnul= l(1) __alloc_align(2) > 281130 pfg __alloc_size(3); /* (ADV) = */