smbfs bug introduced at smbfs_vnops.c:1.58

Bakul Shah bakul at
Sun Apr 10 11:43:31 PDT 2005

> A similar example with "double a;" is more interesting.  This also
> gives undefined behaviour (C99 6.5.5[#5]).  However, this is bogus if
> there is a floating point infinity.  C99 has support for IEEE floating
> point and it is clearly intended that the behaviour of 1.0/0.0 is to
> give +Inf and raise the divide-by-zero exception, but I couldn't see
> anywhere in the C99 draft n869.txt where this is spelled out (raising of
> the divide-by-zero exception is spelled out for lots of math functions
> but doesn't seem to be mentioned for plain division).

This is indirectly spelled out in draft n2764.txt in annex F:

       F.3  Operators and functions

       [#1] C operators and functions provide  IEC  60559  required
       and recommended facilities as listed below.

         -- The +, -, *, and / operators provide the IEC 60559 add,
            subtract, multiply, and divide operations.

IEC 60599 (aka IEEE754) clearly states the behavior for
divide by zero.  6.5.5 does say x/0 is undefined but if
__STDC_IEC_559__ is defined then IEEE behavior is expected.

I haven't checked gassy-c (gcc) for conformance.

More information about the freebsd-fs mailing list