public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ENUM_BITFIELD and -fshort-enums
@ 2004-12-09 17:46 Daniel Jacobowitz
  2004-12-09 18:00 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-12-09 17:46 UTC (permalink / raw)
  To: gcc, Paul Brook

I tried to build a native arm-unknown-linux-gnueabi compiler yesterday.
The only major problem was the fact that EABI defaults to
-fshort-enums.  rtl.h has this:

  /* The kind of expression this is.  */
  ENUM_BITFIELD(rtx_code) code: 16;

But since there are only 164 RTL codes at present, with -fshort-enums
the underlying type of enum rtx_code is "char".  So GCC gives an error
that the bitfield is wider than its type.

For now I'm just using an x-linuxeabi file which builds GCC using
-fno-short-enums, but that's not a good solution.  Should this bitfield
be allowed?

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ENUM_BITFIELD and -fshort-enums
  2004-12-09 17:46 ENUM_BITFIELD and -fshort-enums Daniel Jacobowitz
@ 2004-12-09 18:00 ` Daniel Jacobowitz
  2004-12-09 18:16   ` Steven Bosscher
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-12-09 18:00 UTC (permalink / raw)
  To: gcc

On Thu, Dec 09, 2004 at 12:46:14PM -0500, Daniel Jacobowitz wrote:
> I tried to build a native arm-unknown-linux-gnueabi compiler yesterday.
> The only major problem was the fact that EABI defaults to
> -fshort-enums.  rtl.h has this:
> 
>   /* The kind of expression this is.  */
>   ENUM_BITFIELD(rtx_code) code: 16;
> 
> But since there are only 164 RTL codes at present, with -fshort-enums
> the underlying type of enum rtx_code is "char".  So GCC gives an error
> that the bitfield is wider than its type.
> 
> For now I'm just using an x-linuxeabi file which builds GCC using
> -fno-short-enums, but that's not a good solution.  Should this bitfield
> be allowed?

Other alternative fixes:

  - Add an RTX code with value 65535 to force the enum to be large
    enough.
  - Shrink the bitfield and leave 8 bits of padding in struct rtx_def.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ENUM_BITFIELD and -fshort-enums
  2004-12-09 18:00 ` Daniel Jacobowitz
@ 2004-12-09 18:16   ` Steven Bosscher
  2004-12-15 20:58     ` Mark Mitchell
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Bosscher @ 2004-12-09 18:16 UTC (permalink / raw)
  To: gcc; +Cc: Daniel Jacobowitz

On Thursday 09 December 2004 19:00, Daniel Jacobowitz wrote:
>   - Shrink the bitfield and leave 8 bits of padding in struct rtx_def.

Sounds like the better idea.

Gr.
Steven

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ENUM_BITFIELD and -fshort-enums
  2004-12-09 18:16   ` Steven Bosscher
@ 2004-12-15 20:58     ` Mark Mitchell
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Mitchell @ 2004-12-15 20:58 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc, Daniel Jacobowitz

Steven Bosscher wrote:
> On Thursday 09 December 2004 19:00, Daniel Jacobowitz wrote:
> 
>>  - Shrink the bitfield and leave 8 bits of padding in struct rtx_def.
> 
> 
> Sounds like the better idea.

I agree.  I'll preapprove such a patch.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-15 20:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 17:46 ENUM_BITFIELD and -fshort-enums Daniel Jacobowitz
2004-12-09 18:00 ` Daniel Jacobowitz
2004-12-09 18:16   ` Steven Bosscher
2004-12-15 20:58     ` Mark Mitchell

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).