[PATCH] -funsigned-bitfields breaks parsing

Eric Raskin ehr@listworks.com
Wed Jun 2 07:50:00 GMT 1999


Sorry all -- I missed one type in the following patch.  Please ignore the prior post of the same name and use this one instead.

******************

This patch repairs a problem causing the following tests to fail when -funsigned-bitfields is specified on the command line:

	gcc -funsigned-bitfields -pedantic-errors -ansi -c g++.old-deja/g++.bugs/900401_01.C
	gcc -funsigned-bitfields -pedantic-errors -ansi -c g++.old-deja/g++.bugs/900402_01.C

When unsigned bitfields was specified, the basic type of a variable was defaulted to unsigned, rather than passing through if it was an aggregate.

ChangeLog:

Wed 02 Jun 1999 09:21:10 Eric Raskin (ehr@listworks.com)

	* cp/decl.c: Don't default to unsigned if -funsigned-bitfield and
	not a basic type.

--- /lw/downloads/egcs-19990524-orig/gcc/cp/decl.c	Thu May 20 14:10:51 1999
+++ /lw/downloads/egcs-19990524/gcc/cp/decl.c	Wed Jun  2 10:47:23 1999
@@ -9912,6 +9912,16 @@ grokdeclarator (declarator, declspecs, d
 	      || ! (typedef_decl != NULL_TREE
 		    && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
 	  && TREE_CODE (type) != ENUMERAL_TYPE
+  /* the type must be a basic type, even if it was defaulted to int */
+	  && TREE_CODE (type) != ARRAY_TYPE
+	  && TREE_CODE (type) != RECORD_TYPE
+	  && TREE_CODE (type) != UNION_TYPE
+	  && TREE_CODE (type) != QUAL_UNION_TYPE
+	  && TREE_CODE (type) != SET_TYPE
+	  && TREE_CODE (type) != REFERENCE_TYPE
+	  && TREE_CODE (type) != OFFSET_TYPE
+	  && TREE_CODE (type) != POINTER_TYPE
+	  && TREE_CODE (type) != FUNCTION_TYPE
 	  && RIDBIT_NOTSETP (RID_SIGNED, specbits)))
     {
       if (longlong)
	
------------------------------------------------------------------------
Eric H. Raskin                            Voice:  914-769-7100 x321
President, CSC Division                   Fax:    914-769-8070
The Listworks Corp.                       E-Mail: ehr@listworks.com
1 Campus Drive
Pleasantville, NY 10570



More information about the Gcc-patches mailing list