From mboxrd@z Thu Jan 1 00:00:00 1970 From: woudshoo@xs4all.nl To: gcc-gnats@gcc.gnu.org Subject: objc/3822: gcc crashes when compiling class that contains bitfield with enums Date: Wed, 25 Jul 2001 13:46:00 -0000 Message-id: <20010725204319.16791.qmail@sourceware.cygnus.com> X-SW-Source: 2001-07/msg00687.html List-Id: >Number: 3822 >Category: objc >Synopsis: gcc crashes when compiling class that contains bitfield with enums >Confidential: no >Severity: serious >Priority: low >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Jul 25 13:46:04 PDT 2001 >Closed-Date: >Last-Modified: >Originator: woudshoo@xs4all.nl >Release: gcc version 3.0 >Organization: >Environment: Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs Configured with: ../gcc-3.0/configure --prefix=/usr --with-threads=posix : (reconfigured) ../gcc-3.0/configure --prefix=/usr --enable-threads Thread model: posix >Description: compiling a class that contains a enum bitfield type crashes with the following error message (See source in How-To-Repeat): PROMPT> gcc bugsource.m bugsource.m:20: Internal compiler error in encode_complete_bitfield, at objc/objc-act.c:6879 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. >How-To-Repeat: typedef enum { a, b } countingType; @interface Test { struct { countingType x : 3; } i; } @end @implementation Test @end int main (void) { return 1; } >Fix: Workaround: Do not use enum bitfields. Partial fix: Apply the patch below following diff to objc/objc-act.c. Two remarks: - I have no idea if this is a correct fix. - If the fix is correct, it probably should also be applied to encode_type and perhaps a few other places ------------- *** gcc/objc/objc-act-orig.c Wed Jul 25 21:54:56 2001 --- gcc/objc/objc-act.c Wed Jul 25 21:55:50 2001 *************** *** 6830,6840 **** static void encode_complete_bitfield (int position, tree type, int size) { - enum tree_code code = TREE_CODE (type); char buffer[40]; char charType = '?'; ! if (code == INTEGER_TYPE) { if (integer_zerop (TYPE_MIN_VALUE (type))) { --- 6830,6839 ---- static void encode_complete_bitfield (int position, tree type, int size) { char buffer[40]; char charType = '?'; ! if (INTEGRAL_TYPE_P (type)) { if (integer_zerop (TYPE_MIN_VALUE (type))) { *************** *** 6853,6858 **** --- 6852,6859 ---- } else if (TYPE_MODE (type) == DImode) charType = 'Q'; + else + abort (); } else *************** *** 6872,6877 **** --- 6873,6880 ---- else if (TYPE_MODE (type) == DImode) charType = 'q'; + else + abort (); } } >Release-Note: >Audit-Trail: >Unformatted: