re PR middle-end/54515 (cc1plus sigsegv -O2 anonymous namespace)
2012-09-11 Richard Guenther <rguenther@suse.de> PR middle-end/54515 * gimple.c (get_base_address): Do not return NULL_TREE apart from for WITH_SIZE_EXPR. * gimple-fold.c (canonicalize_constructor_val): Do not call get_base_address when not necessary. * g++.dg/tree-ssa/pr54515.C: New testcase. From-SVN: r191174
This commit is contained in:
parent
d015040192
commit
5a27a197d8
@ -1,3 +1,11 @@
|
||||
2012-09-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/54515
|
||||
* gimple.c (get_base_address): Do not return NULL_TREE apart
|
||||
from for WITH_SIZE_EXPR.
|
||||
* gimple-fold.c (canonicalize_constructor_val): Do not call
|
||||
get_base_address when not necessary.
|
||||
|
||||
2012-09-10 Andrew Pinski <apinski@cavium.com>
|
||||
|
||||
PR tree-opt/54362
|
||||
|
@ -154,13 +154,15 @@ canonicalize_constructor_val (tree cval, tree from_decl)
|
||||
}
|
||||
if (TREE_CODE (cval) == ADDR_EXPR)
|
||||
{
|
||||
tree base = get_base_address (TREE_OPERAND (cval, 0));
|
||||
if (!base && TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR)
|
||||
tree base = NULL_TREE;
|
||||
if (TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR)
|
||||
{
|
||||
base = COMPOUND_LITERAL_EXPR_DECL (TREE_OPERAND (cval, 0));
|
||||
if (base)
|
||||
TREE_OPERAND (cval, 0) = base;
|
||||
}
|
||||
else
|
||||
base = get_base_address (TREE_OPERAND (cval, 0));
|
||||
if (!base)
|
||||
return NULL_TREE;
|
||||
|
||||
|
14
gcc/gimple.c
14
gcc/gimple.c
@ -2878,16 +2878,12 @@ get_base_address (tree t)
|
||||
&& TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR)
|
||||
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
|
||||
|
||||
if (TREE_CODE (t) == SSA_NAME
|
||||
|| DECL_P (t)
|
||||
|| TREE_CODE (t) == STRING_CST
|
||||
|| TREE_CODE (t) == CONSTRUCTOR
|
||||
|| INDIRECT_REF_P (t)
|
||||
|| TREE_CODE (t) == MEM_REF
|
||||
|| TREE_CODE (t) == TARGET_MEM_REF)
|
||||
return t;
|
||||
else
|
||||
/* ??? Either the alias oracle or all callers need to properly deal
|
||||
with WITH_SIZE_EXPRs before we can look through those. */
|
||||
if (TREE_CODE (t) == WITH_SIZE_EXPR)
|
||||
return NULL_TREE;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,3 +1,8 @@
|
||||
2012-09-11 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/54515
|
||||
* g++.dg/tree-ssa/pr54515.C: New testcase.
|
||||
|
||||
2012-09-10 Andrew Pinski <apinski@cavium.com>
|
||||
|
||||
PR tree-opt/c54362
|
||||
|
19
gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Normal file
19
gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Normal file
@ -0,0 +1,19 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-O2" }
|
||||
|
||||
template < typename T > T h2le (T)
|
||||
{
|
||||
T a;
|
||||
unsigned short &b = a;
|
||||
short c = 0;
|
||||
unsigned char (&d)[2] = reinterpret_cast < unsigned char (&)[2] > (c);
|
||||
unsigned char (&e)[2] = reinterpret_cast < unsigned char (&)[2] > (b);
|
||||
e[0] = d[0];
|
||||
return a;
|
||||
}
|
||||
|
||||
void
|
||||
bar ()
|
||||
{
|
||||
h2le ((unsigned short) 0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user