|
From: Julian S. <js...@ac...> - 2003-04-04 19:49:56
|
Hi. Yes, 1.9.4 does have an obscure bug in the handling of floating
point conditional code sometimes. I've fixed it in cvs and I hope to
get it out to the world by shipping 1.9.5 at the weekend, or soon
thereafter. In the meantime I attach a patch with the fix -- easy,
you just need to delete two lines of code.
It would be good if you could confirm that it works.
Thanks for chasing down a small example, even though I didn't use it
-- you've no idea how much that helps. Reproducing problems that people
report is the #1 problem we have in debugging V; once we reproduce a
problem, tracking it down is simple.
J
Index: coregrind/vg_from_ucode.c
===================================================================
RCS file: /cvsroot/valgrind/valgrind/coregrind/vg_from_ucode.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -p -r1.41 -r1.42
--- coregrind/vg_from_ucode.c 26 Mar 2003 21:08:00 -0000 1.41
+++ coregrind/vg_from_ucode.c 26 Mar 2003 23:43:57 -0000 1.42
@@ -3412,8 +3412,6 @@ static void emitUInstr ( UCodeBlock* cb,
case FPU:
vg_assert(u->tag1 == Lit16);
vg_assert(u->tag2 == NoValue);
- if (anyFlagUse ( u ))
- emit_get_eflags();
if (!(*fplive)) {
emit_get_fpu_state();
*fplive = True;
On Friday 04 April 2003 6:57 pm, Dominic Mazzoni wrote:
> Hi,
>
> I've been using valgrind for about six months, and it's been wonderful to
> have. I was spoiled having access to purify on Solaris machines for a
> while, and missed having something similar on Linux. Many thanks to
> Julian Seward and everyone else who contributed to its development.
>
> I've included a very small program that generates different output when
> it's run through valgrind. I noticed the error while I was debugging a
> function to quickly check if an array of single-precision floats has any
> NaNs in it - it turns out that doing a bitwise test is 2-3x faster than
> calling the finite() function.
>
> Anyway, the error only occurs if you compile it with the options:
>
> gcc -O2 -mcpu=pentiumpro -march=pentiumpro
>
> However, the exact same error occurs whether I compile the program with
> gcc 2.96 (RedHat 7.3's version) or gcc 3.2.
>
> The correct output of the program is "0.000000". When run under valgrind
> 1.9.4, it outputs "1.000000".
>
> I hope this helps! It's easy enough for me to work around, but I can only
> guess that this is probably the symptom of a bug that could manifest
> itself in other ways.
>
> - Dominic
>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> union {
> float a[2];
> int b[2];
> } u;
>
> u.a[0] = 0.0 / 0.0;
> u.a[1] = ((*u.b & 0x7FC00000) != 0x7FC00000);
> printf("%f\n", u.a[1]);
>
> return 0;
> }
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb:
> Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
> No other company gives more support or power for your dedicated server
> http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|