This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR c++/18968, types mismatch with NE_EXPR


The problem here is that the front-end was producing a NE_EXPR with
types mismatched.  When we get done to DOM, DOM compares the integer
constant's type to see if it is an integer type.  DOM is expecting
the other side of the NE_EXPR to be a SSA_NAME but we have an address
expression and is a pointer type.  This is all wrong, the integer
constant, zero, should have the same type as the other side, a
pointer type.  In fact after fixing that problem, the testcase
stops ICEing.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Thanks,
Andrew Pinski
Testcase:
// { dg-do compile }
// { dg-options "-O1" }
struct X
{
  int i;
};
struct Y : virtual X {};
struct Z : Y {};
struct A
{
  Z* p;
  A();
};
A::A() : p(0)
{
  ((X*)(Y*)p)->i++;
}

ChangeLog:

	* class.c (build_base_path): Convert the zero constant to the correct
	type when comparing.

Attachment: temp.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]