re PR middle-end/42760 (ICE in convert_move)

PR middle-end/42760
	Backport from trunk
	2009-06-17  Steve Ellcey  <sje@cup.hp.com>

	* expr.c (expand_assignment): Change complex type check.

	* g++.dg/torture/pr42760.C: New test.

From-SVN: r155959
This commit is contained in:
Jakub Jelinek 2010-01-16 10:44:57 +01:00 committed by Jakub Jelinek
parent 7966bada05
commit 5ecfb05d10
4 changed files with 61 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2010-01-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/42760
Backport from trunk
2009-06-17 Steve Ellcey <sje@cup.hp.com>
* expr.c (expand_assignment): Change complex type check.
2010-01-15 Jing Yu <jingyu@google.com>
PR rtl-optimization/42691

View File

@ -1,6 +1,6 @@
/* Convert tree expression to rtl instructions, for GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -4248,7 +4248,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
/* Handle expand_expr of a complex value returning a CONCAT. */
if (GET_CODE (to_rtx) == CONCAT)
{
if (TREE_CODE (TREE_TYPE (from)) == COMPLEX_TYPE)
if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from))))
{
gcc_assert (bitpos == 0);
result = store_expr (from, to_rtx, false, nontemporal);

View File

@ -1,3 +1,8 @@
2010-01-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/42760
* g++.dg/torture/pr42760.C: New test.
2010-01-15 Jing Yu <jingyu@google.com>
PR rtl-optimization/42691

View File

@ -0,0 +1,46 @@
// PR middle-end/42760
// { dg-do compile }
template <typename T>
struct A
{
static T b (T it) { return it; }
};
template <typename T, typename U>
static U
baz (T x, T y, U z)
{
for (long n = y - x; n > 0; --n)
{
*z = *x;
++z;
}
};
template <typename T, typename U>
U
bar (T x, T y, U z)
{
baz (A <T>::b (x), A <T>::b (y), A <U>::b (z));
}
struct C
{
__complex__ float v;
};
template <class T>
struct B
{
B (T y[]) { bar (y, y + 1, x); }
operator T *() { return x; }
T x[1];
};
B <C>
foo ()
{
C y[1];
return B <C> (y);
};