Commit 42ed6cde by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/58344 (ICE with segfault at -O1 and above on x86_64-linux-gnu)

	PR middle-end/58344
	* expr.c (expand_expr_real_1): Handle init == NULL_TREE.

	* gcc.c-torture/compile/pr58344.c: New test.

From-SVN: r206685
parent a611d7cb
2014-01-16 Jakub Jelinek <jakub@redhat.com> 2014-01-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/58344
* expr.c (expand_expr_real_1): Handle init == NULL_TREE.
PR target/59839 PR target/59839
* config/i386/i386.c (ix86_expand_builtin): If target doesn't * config/i386/i386.c (ix86_expand_builtin): If target doesn't
satisfy operand 0 predicate for gathers, use a new pseudo as satisfy operand 0 predicate for gathers, use a new pseudo as
......
...@@ -9832,7 +9832,25 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, ...@@ -9832,7 +9832,25 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|| TREE_CODE (array) == CONST_DECL) || TREE_CODE (array) == CONST_DECL)
&& (init = ctor_for_folding (array)) != error_mark_node) && (init = ctor_for_folding (array)) != error_mark_node)
{ {
if (TREE_CODE (init) == CONSTRUCTOR) if (init == NULL_TREE)
{
tree value = build_zero_cst (type);
if (TREE_CODE (value) == CONSTRUCTOR)
{
/* If VALUE is a CONSTRUCTOR, this optimization is only
useful if this doesn't store the CONSTRUCTOR into
memory. If it does, it is more efficient to just
load the data from the array directly. */
rtx ret = expand_constructor (value, target,
modifier, true);
if (ret == NULL_RTX)
value = NULL_TREE;
}
if (value)
return expand_expr (value, target, tmode, modifier);
}
else if (TREE_CODE (init) == CONSTRUCTOR)
{ {
unsigned HOST_WIDE_INT ix; unsigned HOST_WIDE_INT ix;
tree field, value; tree field, value;
......
2014-01-16 Jakub Jelinek <jakub@redhat.com> 2014-01-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/58344
* gcc.c-torture/compile/pr58344.c: New test.
PR target/59839 PR target/59839
* gcc.target/i386/pr59839.c: New test. * gcc.target/i386/pr59839.c: New test.
......
/* PR middle-end/58344 */
/* { dg-do compile } */
struct U {};
static struct U a[1];
extern void bar (struct U);
void
foo (void)
{
bar (a[0]);
}
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