pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #19066: postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86: Array index check in wrong place ?
2+ messages / 2 participants
[nested] [flat]

* BUG #19066: postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86: Array index check in wrong place ?
@ 2025-09-26 09:51  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2025-09-26 09:51 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: dcb314@hotmail.com

The following bug has been logged on the website:

Bug reference:      19066
Logged by:          David Binderman
Email address:      dcb314@hotmail.com
PostgreSQL version: 18.0
Operating system:   fedora 42
Description:        

Static analyser cppcheck says:

postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86:22: style: Array
index 'j' is used before limits check. [arrayIndexThenCheck]

Source code is

  while ((city_table[j].select_list == -1) && (j < num_gene))

Suggest new source code

  while ((j < num_gene) && (city_table[j].select_list == -1))



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #19066: postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86: Array index check in wrong place ?
@ 2025-09-26 14:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-09-26 14:53 UTC (permalink / raw)
  To: dcb314@hotmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> Static analyser cppcheck says:

> postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86:22: style: Array
> index 'j' is used before limits check. [arrayIndexThenCheck]

Did your static analyzer not notice that this dead code is
not even compiled?  I don't have a lot of faith in analyzers
that ignore #ifdefs.

(It's fair to ask why we haven't removed this code altogether
... laziness I guess, or waiting for something better than
GEQO to come along.  But expending effort on fixing it
is definitely not in the cards.)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-09-26 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-26 09:51 BUG #19066: postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86: Array index check in wrong place ? PG Bug reporting form <noreply@postgresql.org>
2025-09-26 14:53 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox