This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: valarray_copy implementation question


The case I have is for SH4. I'll try to reduce and reproduce on x86.

However, reading the code, the scenario is easy to describe. I you have a bool Array with only false value the while (! *__ok) loop while go forever. so a check on the count is needed.

As an illustration, the code could be rewritten as

      _Tp* __q (__b._M_data);
      bool* __ok (__m._M_data);
      for (_Tp* __p = __a._M_data; __p < __a._M_data+__n;
	   ++__p, ++__ok, ++__q)
	{
	  if (*__ok)
              *__q = *__p;
	}

but that implies that the size if each array is __n, which is not apparently the original Standard interpretation.

Best Regards

Christian

Paolo Carlini wrote:
Gabriel Dos Reis wrote:
I did not consider the interpretation put forward by Christian, although I can
see his point. I suspect I have to double-check what Fortran
does in this case and consider whether it actually is a LWG issue.
Thanks Gaby for your help.
Do you know what other implementations do?
I can check another one. If you can pass me a precise testcase, then I
can give you the data point.

Paolo.



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