|
From: | Nick Clifton |
Subject: | Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7 |
Date: | Wed, 14 Jul 2004 15:07:30 +0100 |
User-agent: | Mozilla Thunderbird 0.7 (X11/20040615) |
Hi Eric, [oops - pressed send by mistake. here is the reply I meant to write...]
Maybe... It involves arithmetic comparisons of pointers to separately allocated objects, which is a bit dubious in the first place.
Note that it doesn't compare pointers directly, but first performs a substraction on pointers which is strictly specified by C99 6.5.6 ยง9: "When two pointers are substracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements."
Which is OK if the two pointers a re both pointing to elements of the same array. If however they are pointing to malloc()'ed structures for example then the semantics are not defined. So the problem with elf_sort_symbol() was that it was comparing pointers to entities that were not part of a single array...
Cheers Nick
[Prev in Thread] | Current Thread | [Next in Thread] |