From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98655 invoked by alias); 11 Dec 2018 15:43:31 -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 98638 invoked by uid 89); 11 Dec 2018 15:43:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Dec 2018 15:43:29 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19F6030821F4; Tue, 11 Dec 2018 15:43:28 +0000 (UTC) Received: from redhat.com (unknown [10.20.4.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63A515D76E; Tue, 11 Dec 2018 15:43:25 +0000 (UTC) Date: Tue, 11 Dec 2018 15:43:00 -0000 From: Marek Polacek To: Jakub Jelinek Cc: Martin Sebor , "Joseph S. Myers" , Jason Merrill , Nathan Sidwell , Gcc Patch List Subject: Re: [PATCH] accept all C integer types in function parameters referenced by alloc_align (PR 88363) Message-ID: <20181211154324.GS21364@redhat.com> References: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com> <20181211071726.GI12380@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181211071726.GI12380@tucnak> User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2018-12/txt/msg00706.txt.bz2 On Tue, Dec 11, 2018 at 08:17:26AM +0100, Jakub Jelinek wrote: > On Mon, Dec 10, 2018 at 04:30:11PM -0700, Martin Sebor wrote: > > Some of my testing exposed a minor problem in GCC 9's validation > > of the type of function parameters referred to by attribute > > positional arguments. Whereas GCC 8 accepts all C integer types, > > including enumerated types, such as: > > > > enum AllocAlign { Align16 = 16, Align32 = 32 }; > > > > __attribute__ ((alloc_align (1))) void* > > alloc (size_t, enum AllocAlign) > > > > GCC 9 only accepts signed and unsigned integer types. This change > > (introduced by myself) was unintentional, and a fix for it is in > > the attached trivial patch. I plan to commit it without approval > > in the next day or so unless any concerns or suggestions come up. > > There is nothing obvious about this, so please don't commit it without > approval. GCC 8 and older used to accept I agree that this isn't an obvious change. > even float or void * or struct arguments and just ignored them. > I think we need to discuss what types we want to allow without warnings and > what we should warn. > As I wrote in the PR, I believe e.g. using alloc_align/alloc_size with > bool/_Bool is just a clear bug, you can store 0 or 1 in there, but e.g. > alignment 0 doesn't make sense. > Enums are on the border line, I'll defer to C/C++ maintainers whether we > want to include that or not. For C, I'd allow them (and I think I've made a change to that effect in the past in the C FE). Marek