This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: [PTACH] strchr broken on SPU with non 16byte aligned argument


Joel Sherrill <joel.sherrill@oarcorp.com> wrote:
> Kazunori Asayama wrote:
> > Andrew_Pinski@playstation.sony.com wrote:
> >   
> >>   I noticed that the GCC testcase gcc.c-torture/execute/string-opt-5.c
> >> is failing on the spu and was debugging it and it looks like strchr does 
> >> not handle correctly a non 16byte aligned agrument.
> >> Here is the reduced testcase which is failing:
> >>     
> >
> > Here is a patch to fix the problem.
> > But I'm worried that there may be similar problem to it...
> >
> >   
> Technically, shouldn't that unsigned int cast be a uintptr_t?

Yes, you are right in general, I think. But in this case, it was not a
reason why the function did not work correctly.

> 
> Any ideas whether other spu/str* code has similar pointer math which
> might be suspect?

Anyway, we should have and run tests against both of aligned and
unaligned inputs. If so, we would be able to avoid this bug. 

And I think that such tests are useful not only for SPU specific
implementations, but also for generic ones
(i.e. newlib/libc/string/*), because some of them also do 'special
processing' against unaligned inputs.

Thanks,
--
(ASAYAMA Kazunori
  (asayama@sm.sony.co.jp))
t


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