https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68271

--- Comment #14 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Quick temporary fix is easy, just make pragma_kind in cp/parser.h 8 bit,
> and change id < 64 to id < 256 in c-family and update the comment.
> This I believe shouldn't make the C++ token any larger.
> And then incrementally we can improve this by dropping pragma_kind.

I have successfully bootstrapped r230151 with the following patch

--- ../_clean/gcc/cp/parser.h   2015-11-10 01:54:44.000000000 +0100
+++ gcc/cp/parser.h     2015-11-11 12:10:28.000000000 +0100
@@ -48,7 +48,7 @@ struct GTY (()) cp_token {
   /* Token flags.  */
   unsigned char flags;
   /* Identifier for the pragma.  */
-  ENUM_BITFIELD (pragma_kind) pragma_kind : 6;
+  ENUM_BITFIELD (pragma_kind) pragma_kind : 8;
   /* True if this token is from a context where it is implicitly extern "C" */
   BOOL_BITFIELD implicit_extern_c : 1;
   /* True if an error has already been reported for this token, such as a
--- ../_clean/gcc/c-family/c-pragma.c   2015-11-10 01:54:43.000000000 +0100
+++ gcc/c-family/c-pragma.c     2015-11-11 12:10:25.000000000 +0100
@@ -1372,7 +1372,7 @@ c_register_pragma_1 (const char *space, 

       /* The C++ front end allocates 6 bits in cp_token; the C front end
         allocates 7 bits in c_token.  At present this is sufficient.  */
-      gcc_assert (id < 64);
+      gcc_assert (id < 256);
     }

   cpp_register_deferred_pragma (parse_in, space, name, id,

I let people understanding the problem update the comment. IMO the comment
should include a pointer to "ENUM_BITFIELD (pragma_kind) pragma_kind : n;" when
updating the assert to 2**n. It would also be interesting to know how many
pragmas can be added before reaching the limit.

Reply via email to