From a0004b27974acee0fd52476f50ca71bb7f5bba25 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 3 Mar 2023 15:27:21 +0100 Subject: [PATCH v12 4/4] Remove unnecessary check from Fisher-Yates implementation Andrey Borodin pointed out that the "undefined data check" was unnecessary for Fisher-Yates implementations when the data that was fetched was known to be initialized. There was one such place in the codebase, so this removes the check there. --- src/backend/optimizer/geqo/geqo_recombination.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/backend/optimizer/geqo/geqo_recombination.c b/src/backend/optimizer/geqo/geqo_recombination.c index a5d3e47ad11..53bf0cc0a42 100644 --- a/src/backend/optimizer/geqo/geqo_recombination.c +++ b/src/backend/optimizer/geqo/geqo_recombination.c @@ -51,9 +51,7 @@ init_tour(PlannerInfo *root, Gene *tour, int num_gene) for (i = 1; i < num_gene; i++) { j = geqo_randint(root, i, 0); - /* i != j check avoids fetching uninitialized array element */ - if (i != j) - tour[i] = tour[j]; + tour[i] = tour[j]; tour[j] = (Gene) (i + 1); } } -- 2.34.1