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=aZG/3cX5NHhFa6QPFmPAL16qT27bCE/A5Zlo1QNU/mo=; b=tgJgq0siSMBTM4XfKzf2ZqHbDifXgeXcwumNCGJAsPKuykM07bWYIXYMeALT87hquA ZLGvfXzvHCGyUFullvz3gucnwz1XWNi0Lz5FuenhpgidkrUWfrSzbptZcUBmkGPR3uST dYa/FKJ+m4D6fZWK/XOh7aFzObfLWNAYMsjyM= 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=btoOd0MPfWy8m7TKdJPuiYWHA+zInh05KjokcOJdioPw8V/fKFkz9J2AHbakmg+G9p RYiJQSDgETVQsqhL3XwqTcHcspkmvYiG8xa+/g1+bz9O3qvoGiYz7m2rdBYf3cDxOy+k 8vv8H0OaaUZYu6HytlshoKlv4uucm8HFMyX40= On Mon, Jun 30, 2008 at 9:36 AM, J. Aaron Pendergrass <james.pendergrass@jhuapl.edu> wrote:
On Jun 30, 2008, at 12:26 PM, Clark Cox wrote:
On Mon, Jun 30, 2008 at 6:38 AM, J. Aaron Pendergrass <james.pendergrass@jhuapl.edu> wrote:
I'm aware that this is undefined. I did explicitly say that the C spec leaves this unspecified. But {1,2,7,4} seems like such an odd choice. Especially when looking at the disassembly:
lwz r2,56(r30) addi r2,r2,-8 lwz r9,0(r2) lwz r2,56(r30) addi r0,r2,-4 stw r0,56(r30) lwz r2,56(r30) lwz r0,0(r2) add r0,r9,r0 lwz r2,56(r30) addi r2,r2,-8 stw r0,0(r2)
which really seems to be going out of its way to implement a fairly unintuitive semantics for this piece of undefined behavior and I was curious what the motivation behind this behavior might be.
With undefined behavior, there is no such thing as an "odd choice". There is no choice to be made.
Of course there's a choice to be made. The compiler has to do something. It chose to do something on powerpc that is completely different from what it chooses to do on other architectures, and on other programs which have very similar undefined usages, and which seemed somewhat unintuitive (in the sense that if I were to define a particular behavior it would not have been the one I observed).
That implies that someone consciously chose the behavior that you're seeing. Which isn't necessarily the case. Any time spent on this kind of undefined behavior (by compiler writers) is a waste of time, as nobody should be writing such code, and anyone who does, deserves the undefined behavior that they get.
I'm curious what the motivation is for this particular choice. If you don't know the answer don't respond.
The "answer" is that there isn't any. -- Clark S. Cox III clarkcox3@gmail.com _______________________________________________ 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
participants (1)
-
Clark Cox