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

Andrew Pinski pinskia@physics.uc.edu
Mon Dec 13 23:47:00 GMT 2004


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.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: temp.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041213/2ec2b706/attachment.txt>


More information about the Gcc-patches mailing list