public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Marek Polacek <polacek@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
	       Jakub Jelinek <jakub@redhat.com>,
	Richard Biener <rguenther@suse.de>
Subject: Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)
Date: Wed, 04 Jun 2014 07:17:00 -0000	[thread overview]
Message-ID: <538EC7F5.5090706@redhat.com> (raw)
In-Reply-To: <20140602065257.GF31671@redhat.com>

On 06/02/14 00:52, Marek Polacek wrote:
> Ping.
>
> On Sun, May 25, 2014 at 11:30:51AM +0200, Marek Polacek wrote:
>> On Mon, May 05, 2014 at 10:27:03PM +0200, Marek Polacek wrote:
>>> In this PR the issue is that we reject (valid) code such as
>>> _Alignas (long long) long long foo;
>>> with -m32, because we trip this condition:
>>>
>>>     alignas_align = 1U << declspecs->align_log;
>>>     if (alignas_align < TYPE_ALIGN_UNIT (type))
>>>       {
>>>         if (name)
>>>           error_at (loc, "%<_Alignas%> specifiers cannot reduce "
>>>                     "alignment of %qE", name);
>>>
>>> and error later on, since alignas_align is 4 (correct, see PR52023 for
>>> why), but TYPE_ALIGN_UNIT of long long is 8.  I think TYPE_ALIGN_UNIT
>>> is wrong here as that won't give us minimal alignment required.
>>> In c_sizeof_or_alignof_type we already have the code to compute such
>>> minimal alignment so I just moved the code to a separate function
>>> and used that instead of TYPE_ALIGN_UNIT.
>>>
>>> Note that the test is run only on i?86 and x86_64, because we can't (?)
>>> easily determine which target requires what alignment.
>>>
>>> Regtested/bootstrapped on x86_64-unknown-linux-gnu and
>>> powerpc64-unknown-linux-gnu, ok for trunk?
>>
>> Can I backport this one to 4.9?
Yes, backporting to 4.9 is fine.
jeff

      reply	other threads:[~2014-06-04  7:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05 20:27 Marek Polacek
2014-05-05 20:31 ` Marek Polacek
2014-05-06  8:04 ` Richard Biener
2014-05-06  8:14   ` Jakub Jelinek
2014-05-06  8:58     ` Marek Polacek
2014-05-07 17:15 ` Joseph S. Myers
2014-05-07 18:31   ` H.J. Lu
2014-05-08 18:19     ` Marek Polacek
2014-09-02 22:29       ` H.J. Lu
2014-09-02 22:39         ` H.J. Lu
2014-05-25  9:31 ` Marek Polacek
2014-06-02  6:53   ` Marek Polacek
2014-06-04  7:17     ` Jeff Law [this message]

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=538EC7F5.5090706@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=polacek@redhat.com \
    --cc=rguenther@suse.de \
    /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).