On 2009-04-20 00:30:21 -0700, James Dennett wrote:
> 2009/4/19 Jason Mancini <jayrus...@hotmail.com>:
> >
> >> Vincent Lefevre  writes:
> >>    while ((*(q++))-- == 0) ;
> >
> > Is that defined and legal??  Is q incremented before or after *q
> > is decremented?  They are both post operators!
> 
> It's defined and legal (so long as q != &q, which might well be
[...]

Yes. BTW, I wondered if this could be due to a pathological case
such as a[a[i]] = ..., which is undefined when a[i] == i, even
though the code looks correct. But this seems to be OK.

As the bug occurs only when malloc is in the tested function, I also
wondered whether the failure was due to the use of uninitialized data
or a buffer overflow (note that in particular, the GMP code was much
more complex than my testcase), but again, this is OK.

-- 
Vincent Lefèvre <vinc...@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

Reply via email to