public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
[not found] <817522051E65D511A2740001028074C4C2F507@EX1>
@ 2004-07-13 12:55 ` Nick Clifton
2004-07-14 6:55 ` Eric Botcazou
0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2004-07-13 12:55 UTC (permalink / raw)
To: Kelvin Lee; +Cc: 'bug-binutils@gnu.org', 'gcc-bugs@gcc.gnu.org'
Hi Kelvin,
> Attached test.c is code extracted from elflink.c to demonstrate the problem.
> You can use attached comp.sh to compile the test program. The test program
> must be compile inside the bfd directory of the binutils-2.15 package. The
> embedded data is the data extract from the gcc-3.4 build which caused
> ld-2.15 to crash. BTW, the test program also shows a possible work around of
> the problem, i.e. instead of doing the calculation, simply comparing the
> values inside elf_sort_symbol. (You may also use the attached diff file to
> patch elflink.c.) The patch seems working fine or at least survived the gcc
> build cycle.
Thanks very much for discovering this problem and producing a
workaround. I have applied the patch you suggested, together with this
ChangeLog entry:
bfd/ChangeLog
2004-07-13 Kelvin Lee <Kelvin.Lee@lansa.com.au>
* elflink.c (elf_sort_symbol): Restructure code to avoid bug in
Solairs hosted versions of gcc.
Cheers
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
2004-07-13 12:55 ` binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7 Nick Clifton
@ 2004-07-14 6:55 ` Eric Botcazou
2004-07-14 8:51 ` Nick Clifton
0 siblings, 1 reply; 6+ messages in thread
From: Eric Botcazou @ 2004-07-14 6:55 UTC (permalink / raw)
To: Nick Clifton
Cc: Kelvin Lee, 'bug-binutils@gnu.org',
'gcc-bugs@gcc.gnu.org'
> Thanks very much for discovering this problem and producing a
> workaround. I have applied the patch you suggested, together with this
> ChangeLog entry:
>
> bfd/ChangeLog
> 2004-07-13 Kelvin Lee <Kelvin.Lee@lansa.com.au>
>
> * elflink.c (elf_sort_symbol): Restructure code to avoid bug in
> Solairs hosted versions of gcc.
I'm a bit confused by this patch:
- is there really a bug "in Solaris hosted versions of gcc" involved here?
If so, it would be nice to produce a testcase and file a PR with GCC
bugzilla (cc-ing ebotcazou@gcc.gnu.org would be even nicer).
- is the bug reported by Kevin not a mere duplicate of
http://sources.redhat.com/ml/binutils/2004-06/msg00089.html
which has been fixed by
http://sources.redhat.com/ml/binutils/2004-06/msg00114.html
in which case the patch is superfluous and the ChangeLog entry a bit
misleading?
--
Eric Botcazou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
2004-07-14 6:55 ` Eric Botcazou
@ 2004-07-14 8:51 ` Nick Clifton
2004-07-14 9:58 ` Eric Botcazou
0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2004-07-14 8:51 UTC (permalink / raw)
To: Eric Botcazou
Cc: Kelvin Lee, 'bug-binutils@gnu.org',
'gcc-bugs@gcc.gnu.org'
Hi Eric,
>>bfd/ChangeLog
>>2004-07-13 Kelvin Lee <Kelvin.Lee@lansa.com.au>
>>
>> * elflink.c (elf_sort_symbol): Restructure code to avoid bug in
>> Solairs hosted versions of gcc.
>
>
> I'm a bit confused by this patch:
> - is there really a bug "in Solaris hosted versions of gcc" involved here?
Maybe... It involves arithmetic comparisons of pointers to separately
allocated objects, which is a bit dubious in the first place.
> If so, it would be nice to produce a testcase and file a PR with GCC
> bugzilla (cc-ing ebotcazou@gcc.gnu.org would be even nicer).
Indeed.
> - is the bug reported by Kevin not a mere duplicate of
> http://sources.redhat.com/ml/binutils/2004-06/msg00089.html
Yes.
> which has been fixed by
> http://sources.redhat.com/ml/binutils/2004-06/msg00114.html
Doh! Yes - I missed this. Very sorry. I will revert Kelvin's patch.
Cheers
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
2004-07-14 8:51 ` Nick Clifton
@ 2004-07-14 9:58 ` Eric Botcazou
2004-07-14 13:54 ` Nick Clifton
2004-07-14 13:58 ` Nick Clifton
0 siblings, 2 replies; 6+ messages in thread
From: Eric Botcazou @ 2004-07-14 9:58 UTC (permalink / raw)
To: Nick Clifton
Cc: Kelvin Lee, 'bug-binutils@gnu.org',
'gcc-bugs@gcc.gnu.org'
> Hi Eric,
Hi Nick,
> 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."
So my understanding is that there isn't any GCC bug here.
> Doh! Yes - I missed this. Very sorry. I will revert Kelvin's patch.
Thanks!
--
Eric Botcazou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
2004-07-14 9:58 ` Eric Botcazou
@ 2004-07-14 13:54 ` Nick Clifton
2004-07-14 13:58 ` Nick Clifton
1 sibling, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2004-07-14 13:54 UTC (permalink / raw)
To: Eric Botcazou
Cc: Kelvin Lee, 'bug-binutils@gnu.org',
'gcc-bugs@gcc.gnu.org'
Hi Eric,
>>Hi Eric,
>
>
> Hi Nick,
>
>
>>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."
>
> So my understanding is that there isn't any GCC bug here.
>
>
>>Doh! Yes - I missed this. Very sorry. I will revert Kelvin's patch.
>
>
> Thanks!
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7
2004-07-14 9:58 ` Eric Botcazou
2004-07-14 13:54 ` Nick Clifton
@ 2004-07-14 13:58 ` Nick Clifton
1 sibling, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2004-07-14 13:58 UTC (permalink / raw)
To: Eric Botcazou
Cc: Kelvin Lee, 'bug-binutils@gnu.org',
'gcc-bugs@gcc.gnu.org'
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-07-14 13:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <817522051E65D511A2740001028074C4C2F507@EX1>
2004-07-13 12:55 ` binutils-2.15 - work around for gcc optimization problem on sparc -sun-solaris2.7 Nick Clifton
2004-07-14 6:55 ` Eric Botcazou
2004-07-14 8:51 ` Nick Clifton
2004-07-14 9:58 ` Eric Botcazou
2004-07-14 13:54 ` Nick Clifton
2004-07-14 13:58 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).