From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50847 invoked by alias); 11 Dec 2018 07:17:37 -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 50832 invoked by uid 89); 11 Dec 2018 07:17:36 -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=border, 9s, referred, HTo:U*nathan 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 07:17:35 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26FDCC005F93; Tue, 11 Dec 2018 07:17:34 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F68F608F2; Tue, 11 Dec 2018 07:17:31 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wBB7HS4w019147; Tue, 11 Dec 2018 08:17:28 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wBB7HQr9019146; Tue, 11 Dec 2018 08:17:26 +0100 Date: Tue, 11 Dec 2018 07:17:00 -0000 From: Jakub Jelinek To: Martin Sebor , "Joseph S. Myers" , Marek Polacek , Jason Merrill , Nathan Sidwell Cc: Gcc Patch List Subject: Re: [PATCH] accept all C integer types in function parameters referenced by alloc_align (PR 88363) Message-ID: <20181211071726.GI12380@tucnak> Reply-To: Jakub Jelinek References: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00621.txt.bz2 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 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. Jakub