New config feature - time1 can declare GPS wraparound compensation

Sanjeev Gupta ghane0 at gmail.com
Fri Aug 16 20:34:16 UTC 2019


Eric,

sizeof(double) seems to be 8 bytes.  The 8192 * No of Secs per week
overflows this.

More info below:
root at ntpmon:/tmp# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-19'
--with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib
--enable-objc-gc=auto --enable-targets=all --enable-multiarch
--disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
--with-build-config=bootstrap-lto --enable-link-mutex
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-19)


root at ntpmon:/tmp# cat aa.c
    #include <stdio.h>
    int main()
    {
        int integerType;
        float floatType;
        double doubleType;
        char charType;
        // Sizeof operator is used to evaluate the size of a variable
        printf("Size of int: %ld bytes\n",sizeof(integerType));
        printf("Size of float: %ld bytes\n",sizeof(floatType));
        printf("Size of double: %ld bytes\n",sizeof(doubleType));
        printf("Size of char: %ld byte\n",sizeof(charType));
        return 0;
    }

root at ntpmon:/tmp# gcc aa.c

root at ntpmon:/tmp# ./a.out
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 byte

root at ntpmon:/tmp# uname -a
Linux ntpmon 4.19.0-5-686-pae #1 SMP Debian 4.19.37-3 (2019-05-15) i686
GNU/Linux
-- 
Sanjeev Gupta
+65 98551208     http://www.linkedin.com/in/ghane


On Sat, Aug 17, 2019 at 3:01 AM Eric S. Raymond <esr at thyrsus.com> wrote:

> Sanjeev Gupta <ghane0 at gmail.com>:
> > Eric,
> >
> > On a 32-bit debian:
> >
> > [ 73/101] Compiling ntpd/ntp_io.c
> > ../../ntpd/ntp_scanner.c: In function ‘yylex’:
> > ../../ntpd/ntp_scanner.c:40:30: warning: integer overflow in expression
> of
> > type ‘long int’ results in ‘659554304’ [-Woverflow]
> >  #define GPS_ERA_13BIT (8192L * SECONDS_IN_WEEK)
> >                               ^
> > ../../ntpd/ntp_scanner.c:940:20: note: in expansion of macro
> ‘GPS_ERA_13BIT’
> >       era_offset += GPS_ERA_13BIT;
>
> That is rather odd.  The L suffix on one of the multiplicands shhould have
> clued in the compiler that the expression has type long.
>
> What is sizeof(double) in that environment?
>
> Attempt at a fix pushed. Let me know if it continues to complain.
> --
>                 <a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20190817/b4e7e343/attachment-0001.htm>


More information about the devel mailing list