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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120498
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
+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.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+struct Geometry
+{
+ int type:16;
+};
+struct Geometry get() {};
+int f()
+{
+ struct Geometry test;
+ return get().type == test.type;
+}
+
{
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;
}