public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>,
	       "Joseph S. Myers" <joseph@codesourcery.com>,
	       Marek Polacek <polacek@redhat.com>,
	Jason Merrill <jason@redhat.com>,
	       Nathan Sidwell <nathan@acm.org>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] accept all C integer types in function parameters referenced by alloc_align (PR 88363)
Date: Tue, 11 Dec 2018 07:17:00 -0000	[thread overview]
Message-ID: <20181211071726.GI12380@tucnak> (raw)
In-Reply-To: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com>

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

  reply	other threads:[~2018-12-11  7:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 23:30 Martin Sebor
2018-12-11  7:17 ` Jakub Jelinek [this message]
2018-12-11 15:14   ` Jason Merrill
2018-12-11 15:43   ` Marek Polacek
2018-12-11 16:59   ` Martin Sebor
2018-12-11 18:15     ` Marek Polacek
2018-12-11 19:43       ` Martin Sebor
2018-12-11 18:16     ` Joseph Myers
2018-12-11 19:46       ` Martin Sebor
2018-12-11 20:09         ` Jason Merrill
2018-12-11 20:37   ` Martin Sebor
2018-12-11 20:48     ` Jakub Jelinek
2018-12-11 22:46       ` Martin Sebor
2018-12-11 22:52         ` Marek Polacek
2018-12-11 23:08           ` Martin Sebor
2018-12-11 23:19             ` Jason Merrill
2018-12-18 21:42               ` Martin Sebor
2019-01-03 22:12                 ` PING #2 " Martin Sebor
2019-01-04 20:56                   ` Joseph Myers
2019-01-06 10:27     ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211071726.GI12380@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=msebor@gmail.com \
    --cc=nathan@acm.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).