re PR middle-end/19858 (ICE on simple SSE code)

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.

	* gcc.c-torture/compile/20050210-1.c: New test.

From-SVN: r94892
This commit is contained in:
Jakub Jelinek 2005-02-11 22:08:44 +01:00 committed by Jakub Jelinek
parent 28f8ecf912
commit 97e9692bfb
4 changed files with 31 additions and 2 deletions

View File

@ -1,5 +1,9 @@
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.

View File

@ -3076,8 +3076,20 @@ static tree
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;

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,8 @@
/* PR middle-end/19858 */
typedef __SIZE_TYPE__ size_t;
union U { int c; } foo;
int bar (void)
{
return !(((size_t) &foo & 3) == 0 && !((size_t) &foo & 1));
}