Bug in dlls/oleaut32/tests/vartype.c?

Gerald Pfeifer gerald at pfeifer.com
Thu Nov 1 09:02:08 CDT 2007


[ Updated patch at the end, Alexandre. ]

On Mon, 29 Oct 2007, Alex Villací­s Lasso wrote:
> Sorry to object, but which version of exactly which compiler optimizes 
> away the negative sign?

You're right, I misread this, sorry.  My original patch wasn't wrong, 
but the explanation was, and there seems in fact a better patch.

> Consider the following program:

That's a very fair test, and I enhanced it as follows:

   #include <stdio.h>
   #include <stdlib.h>

   void print(const float f) {

     union x {
        float f;
        unsigned char b[4];
     } u;

     u.f = f;

     printf("Value as float is %f\n", u.f);
     printf("as bytes %02x %02x %02x %02x\n\n",u.b[0],u.b[1],u.b[2],u.b[3]);
   }

   int main() {
     print(-1e-400);
     print(-0.0);
   }

Both GCC 3.4 and GCC 4.2 snapshot give 00 00 00 80 in both cases.  (All 
the original warning referred to actually did was to indicate that the 
compiler actually made this change automatically; that was added with
GCC 4.3 it seems.)

Gerald


ChangeLog:
Use -0.0 directly in test_VarBstrFromR4().

Index: vartype.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tests/vartype.c,v
retrieving revision 1.51
diff -u -3 -p -r1.51 vartype.c
--- vartype.c	20 Aug 2007 12:43:49 -0000	1.51
+++ vartype.c	1 Nov 2007 13:42:48 -0000
@@ -4747,7 +4747,7 @@ static void test_VarBstrFromR4(void)
     }
   }
 
-  f = -1e-400;    /* deliberately cause underflow */
+  f = -0.0;
   hres = pVarBstrFromR4(f, lcid, 0, &bstr);
   ok(hres == S_OK, "got hres 0x%08x\n", hres);
   if (bstr)


More information about the wine-devel mailing list