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]

Re: [PATCH] Fix PR15791, 2nd try



On Jan 27, 2005, at 12:08 PM, Richard Guenther wrote:


Second try - this time it works for even more weird cases.
Also maybe all comments have been addressed.

Another round of testing is in work.

Richard.

I think you still can get a type mismatch. Take the following code (compile with the C++ front-end): int f(int i, unsigned j) { int t = i>j?i:j; int b[2]; return &b[i] == &b[j]; }

you will see &b[i] == &b[j] and no casts so you end up with a comparision
between an unsigned and int without a NOP_EXPR which is wrong.


Also you should try to deal with the following also:

int f(int i, unsigned j)
{
  int t = i>j?i:j;
  int b[2][2];
  return &b[1][i] == &b[1][j];
}

Which you get: ADDR_EXPR<ARRAY_REF<ARRAY_REF <b, 1>,i> > but you might be able to handle
it, I don't know.


Also add testcases to gcc to the testsuite to make sure that you are doing this
optimization correctly and is being done.


-- Pinski


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