diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-08 08:45:05 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-08 08:45:05 +0000 |
commit | 4f7f7efd45b15639029ff88aa51f27e284dd381c (patch) | |
tree | 69763a66482d42b14599835106ea027f80e7499e /gcc/objc | |
parent | 07648566379bd442b9bd7479f77c16ad431c8a82 (diff) | |
download | gcc-4f7f7efd45b15639029ff88aa51f27e284dd381c.tar.gz |
2004-07-08 Joseph S. Myers <jsm@polyomino.org.uk>
Neil Booth <neil@daikokuya.co.uk>
PR c/2511
PR c/3325
* c-decl.c (finish_struct): Ensure bit-fields are given the
correct type.
* c-common.c (c_common_signed_or_unsigned_type): For C, require
the precision to match as well as the mode.
* expr.c (reduce_to_bit_field_precision): New function.
(expand_expr_real_1): Reduce expressions of bit-field type to
proper precision.
* langhooks.h (reduce_bit_field_operations): New hook.
* langhooks-def.h (LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS):
Define.
* c-lang.c, objc/objc-lang.c
(LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS): Define.
* objc/objc-act.c (check_ivars): Convert types to bit-field types
before checking.
* tree.c (build_nonstandard_integer_type): New function.
* tree.h (build_nonstandard_integer_type): New prototype.
* tree-ssa.c (tree_ssa_useless_type_conversion_1): Don't treat
conversions between integer and boolean types as useless.
testsuite:
* gcc.c-torture/execute/bitfld-1.x: Remove.
* gcc.c-torture/execute/bitfld-3.c: New test.
* gcc.dg/bitfld-2.c: Remove XFAILs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84279 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/objc-act.c | 10 | ||||
-rw-r--r-- | gcc/objc/objc-lang.c | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 4526e1845ce..308f2aca988 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -4257,6 +4257,16 @@ check_ivars (tree inter, tree imp) t1 = TREE_TYPE (intdecls); t2 = TREE_TYPE (impdecls); + if (TREE_VALUE (TREE_VALUE (rawimpdecls))) + { + /* t1 is the bit-field type, so t2 must be converted to the + bit-field type for comparison as well. */ + unsigned HOST_WIDE_INT width + = tree_low_cst (TREE_VALUE (TREE_VALUE (rawimpdecls)), 1); + if (width != TYPE_PRECISION (t2)) + t2 = build_nonstandard_integer_type (width, TYPE_UNSIGNED (t2)); + } + if (!comptypes (t1, t2) || !tree_int_cst_equal (TREE_VALUE (TREE_VALUE (rawintdecls)), TREE_VALUE (TREE_VALUE (rawimpdecls)))) diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index fde6cbd0907..c5d099b63d3 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -71,6 +71,8 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl #undef LANG_HOOKS_UNSAFE_FOR_REEVAL #define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval +#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS +#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true #undef LANG_HOOKS_STATICP #define LANG_HOOKS_STATICP c_staticp #undef LANG_HOOKS_NO_BODY_BLOCKS |