2005-02-11 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/19858
+ * fold-const.c (make_bit_field_ref): If bitpos == 0 and bitsize
+ is number of inner's bits, avoid creating a BIT_FIELD_REF.
+
* config/rs6000/sysv4.h (ENDFILE_LINUX_SPEC): Use crtendS.o instead of
crtend.o if -pie. Use %{x:a;:b} spec syntax.
make_bit_field_ref (tree inner, tree type, int bitsize, int bitpos,
int unsignedp)
{
- tree result = build3 (BIT_FIELD_REF, type, inner,
- size_int (bitsize), bitsize_int (bitpos));
+ tree result;
+
+ if (bitpos == 0)
+ {
+ tree size = TYPE_SIZE (TREE_TYPE (inner));
+ if ((INTEGRAL_TYPE_P (TREE_TYPE (inner))
+ || POINTER_TYPE_P (TREE_TYPE (inner)))
+ && host_integerp (size, 0)
+ && tree_low_cst (size, 0) == bitsize)
+ return fold_convert (type, inner);
+ }
+
+ result = build3 (BIT_FIELD_REF, type, inner,
+ size_int (bitsize), bitsize_int (bitpos));
BIT_FIELD_REF_UNSIGNED (result) = unsignedp;
+2005-02-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/19858
+ * gcc.c-torture/compile/20050210-1.c: New test.
+
2005-02-11 Mark Mitchell <mark@codesourcery.com>
PR c++/19755