site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=sGOgsodKjJodlW5gvkAeJd7TanDue5iMLjeBoiZ1Ybc=; b=u5E/FlG/nZ1KeT20SgnwAeTQQFlqqETA37SxnnrDd3uaDH0R8cbTMK3b3ENmiVmpPh uBYM3kQOMAkVEl8J7FNVj9rBLWHr8ZIl9m0PdWPgZoNpkZl0OLW2G8E/kshZWdOpVICu WXJkgtHlzN8pkCNHv770YyZHi1OCfx7PTta8k= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Lde4JxomISt5C3yp1APejkWlHvAvHlRM0ZCdgFaxG2ssSTypEgh59K0BJtSkaLv4Zi NTvgfzo1OJKvYtCBxS9qqV+VciQZnED8vZsz/o2UmnMc++TZWNxEtgzk8Fw6PqnWRM8p 2CX+7XsiF7pEt0XJa5bfe/jMmOnPMqosuICeA= On Mon, Jun 30, 2008 at 6:26 AM, Andrew Pinski <pinskia@gmail.com> wrote:
This code is undefined as you are acessing and modifying a variable with a sequence point inbetween the acess and modification. Try compiling with warnings turned on. -Wsequence-point should get you a warning.
More to the point, what is unspecified is the order of execution of sp = (sp - 1) and the other access of sp. So we could have: sp = sp - 1; *(sp - 2) += *(sp) or *(sp - 2) += *(sp); sp = sp -1 ; or even: tmp = sp -1; (sp - 2) += (*tmp); sp = tmp; So with this case, you get an undefined behavior because of the access. Thanks, Andrew Pinski _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com