Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Tim Hockin <thockin@cobaltnet.com>
To: Ralf Baechle <ralf@uni-koblenz.de>, linux@cthulhu.engr.sgi.com
Cc: cjohnson@cobaltnet.com
Subject: Re: Float / Double issues - solved, perhaps
Date: Wed, 14 Jul 1999 18:18:29 -0700	[thread overview]
Message-ID: <378D36E5.CBF85556@cobaltnet.com> (raw)
In-Reply-To: 19990714235346.A1231@uni-koblenz.de

Ralf Baechle wrote:

> On Mon, Jul 12, 1999 at 08:09:41PM -0700, Tim Hockin wrote:
>
> > Hey gang - I have what seems to be two seperate issues on Mips/Linux
> > (cobalt boxes).
> >
> > 1) Programs using doubles with pthreads get corrupted data in the
> > doubles.
>
> That one is funny.  It was/is a longstanding libc bug originally reported
> by Dong Liu.  I actually thought it'd be fixed but now thanks to your
> report I see it's still broken.  So the multithreaded variant of your
> double.c doesn't work at all on our libc.
>
> The bug is in glibc/sysdeps/unix/sysv/linux/mips/clone.S; I suppose
> Cobalt's libc which I last worked on late October is still using my
> old clone.S from that time or somebody else there came up with a funky
> new bug completly on it's own - which might explain why double.c cannot
> even successfully create the threads.

We have the fix, I think.  Not clone.S, but in
glibc-2.0.7/linuxthreads/internals.h line 86 we need to tell gcc that this
struct (_pthread_descr_struct - which defines the offset of a thread's stack
from a well-aligned, malloc() returned addr) be padded to be aligned
correctly on an 8byte boundary:

-};
+} __attribute__ ((aligned(__alignof__(double))));

It's working for us now.  Please confirm if it works for you folks, too.  A
bug report has been filed for glibc, though I doubt if anything official
goes on for 2.0.x, now. Hopefully 2.1.x will fold this in.  A thread's stack
really should always be well aligned :)  Funny, the doubles were actually
calculated right, but stdio functions use va_arg - which expected double's
to be aligned, and weren't.  The work got done, but it couldn't tell us!

As for the va_arg "bug" - I realized it was pilot error shortly after
sending it out.  I just needed to look at something that was NOT this double
bug for a while. :)  So the new question is who wants to do thread support
in gdb !!

Tim

  parent reply	other threads:[~1999-07-15  1:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-13  3:09 Float / Double issues Tim Hockin
1999-07-14 20:52 ` Ralf Baechle
1999-07-14 21:53 ` Ralf Baechle
1999-07-15  0:38   ` Ralf Baechle
1999-07-15  1:18   ` Tim Hockin [this message]
1999-07-16  0:57     ` Float / Double issues - solved, perhaps Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=378D36E5.CBF85556@cobaltnet.com \
    --to=thockin@cobaltnet.com \
    --cc=cjohnson@cobaltnet.com \
    --cc=linux@cthulhu.engr.sgi.com \
    --cc=ralf@uni-koblenz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox