public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Marek Polacek <polacek@redhat.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix verify_type ICE with -fshort-enum
Date: Tue, 16 Jun 2015 11:14:00 -0000	[thread overview]
Message-ID: <CAFiYyc1wxBA=LcFZ3XztgvtHWg75OLG8xqKZgoz2ztCfT+MrGg@mail.gmail.com> (raw)
In-Reply-To: <20150612080038.GE2756@redhat.com>

On Fri, Jun 12, 2015 at 10:00 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Thu, Jun 11, 2015 at 11:47:43PM +0200, Jan Hubicka wrote:
>> Hi,
>> gcc.c-torture/execute/930408-1.c currently ICE on -fshort-enum target(s) because
>> TYPE_PACKED is not consistently set among type variants.
>
> I guess that's because of the forward declaration in the test.  But I have
> no access to an ARM machine, so can't verify.
>
>> Bootstrapped/regtested ppc64le-linux, OK?
>> Honza
>>
>>       PR middle-end/66325
>>       * c-decl.c (start_enum): Set TYPE_PACKED consistently among type variants.
>> Index: c-decl.c
>> ===================================================================
>> --- c-decl.c  (revision 224250)
>> +++ c-decl.c  (working copy)
>> @@ -7946,7 +7946,8 @@
>>    the_enum->enum_overflow = 0;
>>
>>    if (flag_short_enums)
>> -    TYPE_PACKED (enumtype) = 1;
>> +    for (tree v = TYPE_MAIN_VARIANT (enumtype); v ;v = TYPE_NEXT_VARIANT (v))

Though I wonder why flag_short_enums was not true when building the
(main-)variant?
Looks like -fshort-enums is also 'Optimization', so the above is bogus for

enum foo {x = 1 };

void __attribute__((optimize(short-enums))) foo()
{
  const enum foo x = 1;
}

no?  The main variant is correctly _not_ packed but now you make it
packed as you reach foo ()?

Richard.

> Please fix the formatting here: no space before ;.
>
> Ok with that change.
>
>         Marek

  reply	other threads:[~2015-06-16 11:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 21:49 Jan Hubicka
2015-06-12  8:53 ` Marek Polacek
2015-06-16 11:14   ` Richard Biener [this message]
2015-06-16 22:16     ` Jan Hubicka
2015-06-17 10:51       ` Richard Biener

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='CAFiYyc1wxBA=LcFZ3XztgvtHWg75OLG8xqKZgoz2ztCfT+MrGg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --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).