A broken diagnostic is issued for the following invalid code snippet since at least GCC 2.95.3: ==================================================== struct A { int i : 2; }; void foo(bool b) { A a; (a.i || b)(); } ==================================================== bug.cc: In function 'void foo(bool)': bug.cc:9: error: '(((#'bit_field_ref' not supported by dump_expr#<expression error> & 3u) != 0u) || b)' cannot be used as a function
I happen to have a "fix".
Subject: Bug 35336 Author: rguenth Date: Wed Mar 5 10:32:07 2008 New Revision: 132894 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132894 Log: 2008-03-05 Richard Guenther <rguenther@suse.de> PR c++/35336 * tree.def (BIT_FIELD_REF): Document that operands 1 and 2 should be constants. * tree-cfg.c (verify_expr): Verify it. * fold-const.c (fold_truthop): Remove code generating BIT_FIELD_REFs of structure bases. (fold_binary): Likewise. (fold_ternary): Position and size of BIT_FIELD_REFs are always host integers. (make_bit_field_ref): Remove. (optimize_bit_field_compare): Remove. (all_ones_mask_p): Remove. Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/tree-cfg.c trunk/gcc/tree.def
Oh, fixed.
Subject: Bug 35336 Author: rguenth Date: Wed Jun 11 11:14:59 2008 New Revision: 136662 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136662 Log: 2008-06-11 Richard Guenther <rguenther@suse.de> PR middle-end/35336 * fold-const.c (fold_truthop): Remove code generating BIT_FIELD_REFs of structure bases. (fold_binary): Likewise. (make_bit_field_ref): Remove. (optimize_bit_field_compare): Remove. (all_ones_mask_p): Remove. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/fold-const.c
Also fixed on the 4.3 branch.
The bug reappeared on the 4.3 branch. It remains fixed on mainline, though. So no status change since it's not a regression.
Subject: Bug 35336 Author: jakub Date: Fri Dec 5 16:59:34 2008 New Revision: 142484 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142484 Log: PR middle-end/37248 * fold-const.c (make_bit_field_ref): Change bitpos and bitsize arguments to HOST_WIDE_INT. If type has different signedness than unsignedp or different precision from bitsize, create the right type for BIT_FIELD_REF and cast to type. (fold_truthop): Change first_bit and end_bit to HOST_WIDE_INT. Revert: 2008-03-05 Richard Guenther <rguenther@suse.de> PR c++/35336 * fold-const.c (fold_truthop): Remove code generating BIT_FIELD_REFs of structure bases. (fold_binary): Likewise. (make_bit_field_ref): Remove. (optimize_bit_field_compare): Remove. (all_ones_mask_p): Remove. * gcc.target/i386/pr37248-1.c: New test. * gcc.target/i386/pr37248-2.c: New test. * gcc.target/i386/pr37248-3.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr37248-1.c trunk/gcc/testsuite/gcc.target/i386/pr37248-2.c trunk/gcc/testsuite/gcc.target/i386/pr37248-3.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 35336 Author: jakub Date: Fri Dec 5 21:10:16 2008 New Revision: 142497 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142497 Log: PR c++/35336 * c-pretty-print.c (pp_c_postfix_expression): Handle BIT_FIELD_REF. (pp_c_expression): Likewise. * error.c (dump_expr): Handle BIT_FIELD_REF. * g++.dg/other/error30.C: New test. Added: trunk/gcc/testsuite/g++.dg/other/error30.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-pretty-print.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/error.c trunk/gcc/testsuite/ChangeLog