Обсуждение: [BUGS] postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity checkafter use ?

Поиск
Список
Период
Сортировка

[BUGS] postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity checkafter use ?

От
David Binderman
Дата:
Hello there,

postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84]: (style) Array index 'j' is used before limits check.

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

Suggest sanity check array index before use, not after.

Regards

David Binderman



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [BUGS] postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ?

От
Tom Lane
Дата:
David Binderman <dcb314@hotmail.com> writes:
> postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84]: (style) Array index 'j' is used before limits check.

Hmm, this code is ifdef'd out as of v10, so I'm not sure why your
tool paid any attention to it.

Since it's not used, and hasn't been used in decades, and has got more
bugs than just this stylistic one (in particular, even if we fixed that
innermost loop, the next line would still access the undefined select_list
value; plus I think it will fail badly in the event that the "make a list
of selected cities" loop picks the same "pos" more than once),
I'm disinclined to spend any effort on fixing it.
        regards, tom lane


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs