On Tue, 19 Nov 2013 09:39:33 -0800, Martynas Venckus <[email protected]> wrote:
> On Tue, Nov 19, 2013 at 1:10 AM, Anton Khirnov <[email protected]> wrote:
> 
> >
> > Hi,
> > On Mon, 18 Nov 2013 21:59:52 -0800, Martynas Venckus <[email protected]>
> > wrote:
> > > > It defines {FLT,DBL}_{MAX,MIN} macros, even though float.h is supposed
> > > > to do that.
> > >
> > > Nope.  In OpenBSD, only if you #define _XOPEN_SOURCE < 600, as it's
> > > required by XPG3 - XPG5v2.
> >
> > I admit I only tested on NetBSD and assumed it would be pretty much the
> > same on
> > OpenBSD, as the failures are the same there.
> >
> > On NetBSD, those values are under
> > #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
> > Libav configure defines _XOPEN_SOURCE=600, so they get exported.
> >
> 
> martynas:24$ echo "#include <limits.h>" | gcc -D_XOPEN_SOURCE=600 -dM -E -
> | grep DBL_MAX[^_]
> martynas:25$
> 
> 
> >
> > >
> > > > Those values are not exactly representable double/float as
> > > > the specification mandates, which breaks code (e.g. in vf_fps) like
> > > >
> > > > double f = DBL_MAX;
> > > > [...]
> > > > if (f == DBL_MAX) { // f has not been changed yet
> > > >     [....]
> > > > }
> > >
> > > So this is the exact same snippet running on OpenBSD/i386 (tested with
> > -O0,
> > > -O1, -O2):
> > >
> > > martynas:64$ cat a.c
> > > #include <float.h>
> > > int
> > > main(void)
> > > {
> > >         double f = DBL_MAX;
> > >         if (f == DBL_MAX) {
> > >                 return (1);
> > >         }
> > >         return (0);
> > > }
> > > martynas:65$ gcc a.c
> > > martynas:66$
> > > ./a.out
> > >
> > > martynas:67$ echo $?
> > > 1
> > >
> > > Can you help me reproduce this bug?
> > >
> >
> > Only happens on 32bit and with -std=c99 (more precisely
> > -fexcess-precision=standard, which is enabled by -std=c99).
> > You also have to #include <limits.h> after <float.h>.
> >
> 
> martynas:25$ cat a.c
> #include <float.h>
> int
> main(void)
> {
>         double f = DBL_MAX;
>         if (f == DBL_MAX) {
>                 return (1);
>         }
>         return (0);
> }

Still not including limits.h here.

Or if you feel up to it, you can get Libav source and check whether FATE
(https://libav.org/fate.html) fails in the same way as in
https://fate.libav.org/x86_32-openbsd-egcc/20131116184450

The exact program I'm running is:
#include <float.h
#include <limits.h>
#include <stdio.h>
int main(void)
{
    printf("%d\n", DBL_MAX == (double)DBL_MAX);
    return 0;
}
compiled with gcc -std=c99 on a 32bit NetBSD 6.1.2 VM it prints 0.
If you fail to reproduce this, I can try getting an OpenBSD VM and investigate
closer.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to