re PR tree-optimization/53336 (invalid types in nop conversion)

gcc:
2012-05-16  Paolo Bonzini  <bonzini@gnu.org>

	PR tree-optimization/53336
	* tree-cfg.c (verify_gimple_assign_unary): Allow conversion from
	non-integer integral types to offset type and vice versa.

gcc/testsuite:
2012-05-16  Paolo Bonzini  <bonzini@gnu.org>

	PR tree-optimization/53336
	* g++.dg/torture/pr53336.C: New testcase.

From-SVN: r187759
This commit is contained in:
Paolo Bonzini 2012-05-22 08:31:52 +00:00 committed by Paolo Bonzini
parent 7caf4b0caa
commit 819f3b2cfa
4 changed files with 59 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2012-05-22 Paolo Bonzini <bonzini@gnu.org>
PR tree-optimization/53336
* tree-cfg.c (verify_gimple_assign_unary): Allow conversion from
non-integer integral types to offset type and vice versa.
2012-05-22 Alan Modra <amodra@gmail.com>
* config/rs6000/aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.

View File

@ -1,3 +1,8 @@
2012-05-22 Paolo Bonzini <bonzini@gnu.org>
PR tree-optimization/53336
* g++.dg/torture/pr53336.C: New testcase.
2012-05-22 Dodji Seketeli <dodji@redhat.com>
PR c++/53322

View File

@ -0,0 +1,45 @@
// { dg-do compile }
bool foo();
struct C
{
C()
{
if (foo())
foo();
}
};
struct S
{
struct dummy
{
int i_;
};
typedef int dummy::*bool_type;
operator bool_type() const
{
return foo() ? &dummy::i_ : 0;
}
};
int x;
struct adaptor
{
C c;
virtual void bar()
{
if (S())
x = 0;
}
};
int main()
{
adaptor a;
}

View File

@ -3373,11 +3373,11 @@ verify_gimple_assign_unary (gimple stmt)
|| ptrofftype_p (sizetype))))
return false;
/* Allow conversion from integer to offset type and vice versa. */
/* Allow conversion from integral to offset type and vice versa. */
if ((TREE_CODE (lhs_type) == OFFSET_TYPE
&& TREE_CODE (rhs1_type) == INTEGER_TYPE)
&& INTEGRAL_TYPE_P (rhs1_type))
|| (TREE_CODE (lhs_type) == INTEGER_TYPE
&& TREE_CODE (rhs1_type) == OFFSET_TYPE))
&& INTEGRAL_TYPE_P (rhs1_type)))
return false;
/* Otherwise assert we are converting between types of the