Bug 35336 - Broken diagnostic: 'bit_field_ref' not supported by dump_expr
Summary: Broken diagnostic: 'bit_field_ref' not supported by dump_expr
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Richard Biener
URL:
Keywords: diagnostic, monitored
Depends on:
Blocks: 36449
  Show dependency treegraph
 
Reported: 2008-02-23 19:47 UTC by Volker Reichelt
Modified: 2008-09-13 01:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-03-04 19:59:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-02-23 19:47:23 UTC
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
Comment 1 Richard Biener 2008-03-04 19:59:53 UTC
I happen to have a "fix".
Comment 2 Richard Biener 2008-03-05 10:32:52 UTC
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

Comment 3 Richard Biener 2008-03-14 16:20:16 UTC
Oh, fixed.
Comment 4 Richard Biener 2008-06-11 11:15:53 UTC
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

Comment 5 Volker Reichelt 2008-06-21 20:57:24 UTC
Also fixed on the 4.3 branch.
Comment 6 Volker Reichelt 2008-09-13 01:23:14 UTC
The bug reappeared on the 4.3 branch.
It remains fixed on mainline, though.
So no status change since it's not a regression.
Comment 7 Jakub Jelinek 2008-12-05 17:01:04 UTC
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

Comment 8 Jakub Jelinek 2008-12-05 21:11:42 UTC
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