This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: gcc bug impacts glibc cvs
On Mon, Mar 12, 2001 at 11:06:59AM -0800, Ulrich Drepper wrote:
> Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
>
> > Well, currently this test is quite simple, every GCC does it
> > potentially wrong so far. Maybe a fix can go into gcc-3.0, but most
> > probably it won't be in gcc-2.95.3.
>
> On x86 the problem seems not to appear:
>
> extern void *xyzzy __attribute__ ((__weak__));
> int
> main (void)
> {
> return &xyzzy ? (xyzzy == (void *) 0) : 0;
> }
>
> This succeeds with -O0, -O1, -O2, -O3. Therefore I do not want a
> work-around to go into glibc unconditionally.
>
> If the above test is not enough let's refine it.
I don't know how to easily reproduce the problem on x86, just due to
the vagaries of the scheduler; it appears to be cheap enough to do
short jumps that ?: doesn't get collapsed down into eager evaluation.
Here's a testcase that does actually show the problem on PPC, though:
extern void *xyzzy __attribute__ ((__weak__));
int
main (void)
{
return &xyzzy ? ((int)xyzzy) : 0;
}
(Your original test does not exhibit the problem, for reasons beyond my
immediate sight - again, scheduler quirks).
While it's certainly a bit too fragile of a test, could we at least use
this to autoconf for the bug until someone thinks of a better one?
--
Daniel Jacobowitz Debian GNU/Linux Developer
Monta Vista Software Debian Security Team
"I am croutons!"