Commit 892123df by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/51895 (ICE in simplify_subreg)

	PR middle-end/51895
	* expr.c (expand_expr_real_1): Handle BLKmode MEM_REF of
	non-addressable non-BLKmode base correctly.

	* g++.dg/opt/pr51895.C: New test.

From-SVN: r183560
parent 1a47f99c
2012-01-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/51895
* expr.c (expand_expr_real_1): Handle BLKmode MEM_REF of
non-addressable non-BLKmode base correctly.
2012-01-26 Michael Matz <matz@suse.de> 2012-01-26 Michael Matz <matz@suse.de>
PR tree-optimization/48794 PR tree-optimization/48794
......
...@@ -9327,6 +9327,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, ...@@ -9327,6 +9327,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
bftype = TREE_TYPE (base); bftype = TREE_TYPE (base);
if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode) if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
bftype = TREE_TYPE (exp); bftype = TREE_TYPE (exp);
else
{
temp = assign_stack_temp (DECL_MODE (base),
GET_MODE_SIZE (DECL_MODE (base)),
0);
store_expr (base, temp, 0, false);
temp = adjust_address (temp, BLKmode, offset);
set_mem_size (temp, int_size_in_bytes (TREE_TYPE (exp)));
return temp;
}
return expand_expr (build3 (BIT_FIELD_REF, bftype, return expand_expr (build3 (BIT_FIELD_REF, bftype,
base, base,
TYPE_SIZE (TREE_TYPE (exp)), TYPE_SIZE (TREE_TYPE (exp)),
......
2012-01-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/51895
* g++.dg/opt/pr51895.C: New test.
2012-01-26 Michael Matz <matz@suse.de> 2012-01-26 Michael Matz <matz@suse.de>
PR tree-optimization/48794 PR tree-optimization/48794
......
// PR middle-end/51895
// { dg-do compile }
// { dg-options "-O2" }
struct S
{
long a;
char b;
S () : a (0), b (0) {}
bool baz ();
};
__attribute__((noinline)) static bool
bar (S x, S y)
{
y = x;
return y.baz ();
}
bool
foo (S x)
{
S y;
return bar (x, y);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment