Thread

Commits

  1. Fix compiler warning in rangetypes_spgist.c.

  1. spgist rangetypes compiler warning (gcc 7.2.0)

    Tomas Vondra <tomas.vondra@2ndquadrant.com> — 2017-11-18T19:57:13Z

    Hi,
    
    while compiling on gcc 7.2.0 (on ARM), I got this warning:
    
        rangetypes_spgist.c: In function 'spg_range_quad_inner_consistent':
        rangetypes_spgist.c:559:29: warning: comparison between pointer and
        zero character constant [-Wpointer-compare]
              if (in->traversalValue != (Datum) 0)
                                     ^~
        rangetypes_spgist.c:559:10: note: did you mean to dereference the
        pointer?
              if (in->traversalValue != (Datum) 0)
                  ^
    
    I believe we should simply treat the traversalValue as pointer, and
    change the condition to
    
        if (in->traversalValue)
    
    Patch attached.
    
    
    regards
    
    -- 
    Tomas Vondra                  http://www.2ndQuadrant.com
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
  2. Re: spgist rangetypes compiler warning (gcc 7.2.0)

    Tom Lane <tgl@sss.pgh.pa.us> — 2017-11-18T21:40:13Z

    Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
    > while compiling on gcc 7.2.0 (on ARM), I got this warning:
    
    >     rangetypes_spgist.c: In function 'spg_range_quad_inner_consistent':
    >     rangetypes_spgist.c:559:29: warning: comparison between pointer and
    >     zero character constant [-Wpointer-compare]
    >           if (in->traversalValue != (Datum) 0)
    >                                  ^~
    
    Huh.  I wonder why 7.2.1 on Fedora isn't producing that warning.
    
    > I believe we should simply treat the traversalValue as pointer, and
    > change the condition to
    >     if (in->traversalValue)
    
    Agreed, especially since it's done like that in spgscan.c and
    geo_spgist.c.
    
    			regards, tom lane
    
    
    
  3. Re: spgist rangetypes compiler warning (gcc 7.2.0)

    Tomas Vondra <tomas.vondra@2ndquadrant.com> — 2017-11-18T22:41:12Z

    
    On 11/18/2017 10:40 PM, Tom Lane wrote:
    > Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
    >> while compiling on gcc 7.2.0 (on ARM), I got this warning:
    > 
    >>     rangetypes_spgist.c: In function 'spg_range_quad_inner_consistent':
    >>     rangetypes_spgist.c:559:29: warning: comparison between pointer and
    >>     zero character constant [-Wpointer-compare]
    >>           if (in->traversalValue != (Datum) 0)
    >>                                  ^~
    > 
    > Huh.  I wonder why 7.2.1 on Fedora isn't producing that warning.
    > 
    
    Not sure. Maybe Ubuntu uses different flags (on ARM)? This is what I get
    from 'gcc -v' on the machine:
    
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/7/lto-wrapper
    Target: arm-linux-gnueabihf
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
    7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
    --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr
    --with-gcc-major-version-only --program-suffix=-7
    --program-prefix=arm-linux-gnueabihf- --enable-shared
    --enable-linker-build-id --libexecdir=/usr/lib
    --without-included-gettext --enable-threads=posix --libdir=/usr/lib
    --enable-nls --with-sysroot=/ --enable-clocale=gnu
    --enable-libstdcxx-debug --enable-libstdcxx-time=yes
    --with-default-libstdcxx-abi=new --enable-gnu-unique-object
    --disable-libitm --disable-libquadmath --enable-plugin
    --enable-default-pie --with-system-zlib --with-target-system-zlib
    --enable-objc-gc=auto --enable-multiarch --enable-multilib
    --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16
    --with-float=hard --with-mode=thumb --disable-werror --enable-multilib
    --enable-checking=release --build=arm-linux-gnueabihf
    --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
    Thread model: posix
    gcc version 7.2.0 (Ubuntu/Linaro 7.2.0-8ubuntu3)
    
    regards
    
    -- 
    Tomas Vondra                  http://www.2ndQuadrant.com
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services