Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in zsh 4.0.7

Chris Spiegel wrote:
> Hi,
>   There is a bug in Src/math.c of zsh 4.0.7, line 382.  It is:
> yyval.u.l = zstrtol(++ptr, &ptr, lastbase = 16);
> The issue is that it's unspecified whether ++ptr or &ptr happens first.

I don't think that matters.  &ptr always refers to the same address in
memory, whatever the value of ptr is.

                --- 	       	 ---
Value          | Y |	       	|Y+1|
               |---|	       	|---|
Address  &ptr->|   |   	  &ptr->|   |
                --- 		 ---

ptr has certainly been incremented by the time of the function call, so
the function call can change its value without any problem.

You're worrying about the case where we pass ptr as the second argument,
which as you say is undefined.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

Messages sorted by: Reverse Date, Date, Thread, Author