spgist rangetypes compiler warning (gcc 7.2.0)

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: spgist rangetypes compiler warning (gcc 7.2.0)
Date: 2017-11-18 19:57:13
Message-ID: 99410021-61ef-9a9a-9bc8-f733ece637ee@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-Fix-compiler-warning-when-comparing-traversalValue.patch text/x-patch 1.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2017-11-18 20:28:58 Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Previous Message Peter Eisentraut 2017-11-18 18:40:46 Re: [HACKERS] Consistently catch errors from Python _New() functions