re PR c/2511 (-pedantic not warning about bitfield overflow)
authorJoseph Myers <jsm@polyomino.org.uk>
Thu, 8 Jul 2004 08:45:05 +0000 (09:45 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Thu, 8 Jul 2004 08:45:05 +0000 (09:45 +0100)
commitbc15d0efe4230e2f3636dc5255c331232211fb44
tree69763a66482d42b14599835106ea027f80e7499e
parent942e59391c7a8ff8d57439229877257eb62b2eb0
re PR c/2511 (-pedantic not warning about bitfield overflow)

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.

Co-Authored-By: Neil Booth <neil@daikokuya.co.uk>
From-SVN: r84279
16 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-decl.c
gcc/c-lang.c
gcc/expr.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/objc/objc-act.c
gcc/objc/objc-lang.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/bitfld-1.x [deleted file]
gcc/testsuite/gcc.c-torture/execute/bitfld-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/bitfld-2.c
gcc/tree-ssa.c
gcc/tree.c
gcc/tree.h