Re: warning: comparison of integer expressions of different signedness related to simd.h - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: warning: comparison of integer expressions of different signedness related to simd.h
Date
Msg-id CAFj8pRB1Ouv4kBBxayoRUswnbpsFsOPQdzUPNSEqLgOnjCOvfw@mail.gmail.com
Whole thread Raw
In response to Re: warning: comparison of integer expressions of different signedness related to simd.h  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


so 3. 9. 2022 v 7:57 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
John Naylor <john.naylor@enterprisedb.com> writes:
> On Sat, Sep 3, 2022 at 12:30 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
>> /usr/local/pgsql/master/include/server/port/simd.h: In function ‘vector8_has’:
>> /usr/local/pgsql/master/include/server/port/simd.h:168:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
>> 168 |         for (int i = 0; i < sizeof(Vector8); i++)

> "int" should probably be "Size" -- does that remove the warning?

Agreed, should be Size or size_t, or else cast the sizeof() result.
But I wonder why none of the buildfarm is showing such a warning.

I got this warning when I compiled plgsql_check against master with enabled asserts


In file included from /usr/local/pgsql/master/include/server/mb/pg_wchar.h:22,
                 from src/format.c:17:
/usr/local/pgsql/master/include/server/port/simd.h: In function ‘vector8_has_le’:
/usr/local/pgsql/master/include/server/port/simd.h:219:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
  219 |         for (int i = 0; i < sizeof(Vector8); i++)
      |                           ^





                        regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: warning: comparison of integer expressions of different signedness related to simd.h
Next
From: Julien Rouhaud
Date:
Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error