This is the mail archive of the gcc@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: fold_builtin_memcpy cannot optimize <retval>?



On Jan 21, 2005, at 2:37 PM, Mark Mitchell wrote:


I'm not sure. I seemed to believe in that thread that they could never be NULL, but I'm not sure if everyone agreed, and I see that we suggested a non-NULL tag on objects somewhere. So, in that case, there may be no difference at all to the middle-end. In any case, I think that it would make sense for us to allow a REFERENCE_TYPE anywhere we allow a POINTER_TYPE.


Isn't this valid C++ then (or is it just undefined):
int &f(int *p)
{
  return *p;
}

extern "C" void abort (void);

int main()
{
  int &a = f(0);
  int *a1 = &a;
  if (a1 != 0)
    abort ();
  return 0;
}

If this is valid then REFERENCE_TYPE can be NULL even
in C++ as shown in the above testcase.  Yes this testcase is
something I just made up (and tested) but it just shows that
REFERENCE_TYPEs in C++ can be NULL.

-- Pinski


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