re PR c++/27826 (ICE in copy_to_mode_reg)

2007-01-05  Richard Guenther  <rguenther@suse.de>

	PR middle-end/27826
	* tree.c (get_narrower): Do not construct COMPONENT_REFs
	with mismatched types.  Instead explicitly build a
	conversion NOP_EXPR.

	* g++.dg/opt/pr27826.C: New testcase.

From-SVN: r120498
This commit is contained in:
Richard Guenther 2007-01-05 21:04:23 +00:00 committed by Richard Biener
parent ee167bcb2d
commit afe1a916d7
4 changed files with 28 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2007-01-05 Richard Guenther <rguenther@suse.de>
PR middle-end/27826
* tree.c (get_narrower): Do not construct COMPONENT_REFs
with mismatched types. Instead explicitly build a
conversion NOP_EXPR.
2007-01-05 Ian Lance Taylor <iant@google.com>
* c-common.c (decl_with_nonnull_addr_p): New function.

View File

@ -1,3 +1,8 @@
2007-01-05 Richard Guenther <rguenther@suse.de>
PR middle-end/27826
* g++.dg/opt/pr27826.C: New testcase.
2007-01-05 Ian Lance Taylor <iant@google.com>
* gcc.dg/Walways-true-1.c: New test.

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
struct Geometry
{
int type:16;
};
struct Geometry get() {};
int f()
{
struct Geometry test;
return get().type == test.type;
}

View File

@ -5989,12 +5989,10 @@ get_narrower (tree op, int *unsignedp_ptr)
{
if (first)
uns = DECL_UNSIGNED (TREE_OPERAND (op, 1));
win = build3 (COMPONENT_REF, type, TREE_OPERAND (op, 0),
TREE_OPERAND (op, 1), NULL_TREE);
TREE_SIDE_EFFECTS (win) = TREE_SIDE_EFFECTS (op);
TREE_THIS_VOLATILE (win) = TREE_THIS_VOLATILE (op);
win = fold_convert (type, op);
}
}
*unsignedp_ptr = uns;
return win;
}