diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-05 21:10:16 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-05 21:10:16 +0000 |
commit | a3efadc73059be2ec4dc420e2b1d1614ef882916 (patch) | |
tree | cee1b2906941519dc567d0b6dc148a9e80a5d21b /gcc/c-pretty-print.c | |
parent | c938d9eb3c070db75100f4a1d3f4aedaea9068fe (diff) | |
download | gcc-a3efadc73059be2ec4dc420e2b1d1614ef882916.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142497 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pretty-print.c')
-rw-r--r-- | gcc/c-pretty-print.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 9ee2738ca82..cf1c6c3f52c 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -1444,6 +1444,36 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) } break; + case BIT_FIELD_REF: + { + tree type = TREE_TYPE (e); + + type = signed_or_unsigned_type_for (TYPE_UNSIGNED (type), type); + if (type + && tree_int_cst_equal (TYPE_SIZE (type), TREE_OPERAND (e, 1))) + { + HOST_WIDE_INT bitpos = tree_low_cst (TREE_OPERAND (e, 2), 0); + HOST_WIDE_INT size = tree_low_cst (TYPE_SIZE (type), 0); + if ((bitpos % size) == 0) + { + pp_c_left_paren (pp); + pp_c_left_paren (pp); + pp_type_id (pp, type); + pp_c_star (pp); + pp_c_right_paren (pp); + pp_c_ampersand (pp); + pp_expression (pp, TREE_OPERAND (e, 0)); + pp_c_right_paren (pp); + pp_c_left_bracket (pp); + pp_wide_integer (pp, bitpos / size); + pp_c_right_bracket (pp); + break; + } + } + pp_unsupported_tree (pp, e); + } + break; + case COMPLEX_CST: case VECTOR_CST: pp_c_compound_literal (pp, e); @@ -1955,6 +1985,7 @@ pp_c_expression (c_pretty_printer *pp, tree e) case ARRAY_REF: case CALL_EXPR: case COMPONENT_REF: + case BIT_FIELD_REF: case COMPLEX_CST: case COMPLEX_EXPR: case VECTOR_CST: |