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
This commit is contained in:
parent
1a47f99c0f
commit
892123df86
4 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
PR tree-optimization/48794
|
||||
|
|
10
gcc/expr.c
10
gcc/expr.c
|
@ -9327,6 +9327,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|
|||
bftype = TREE_TYPE (base);
|
||||
if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
|
||||
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,
|
||||
base,
|
||||
TYPE_SIZE (TREE_TYPE (exp)),
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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>
|
||||
|
||||
PR tree-optimization/48794
|
||||
|
|
25
gcc/testsuite/g++.dg/opt/pr51895.C
Normal file
25
gcc/testsuite/g++.dg/opt/pr51895.C
Normal file
|
@ -0,0 +1,25 @@
|
|||
// 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);
|
||||
}
|
Loading…
Add table
Reference in a new issue