Skip to content

Commit 2cf9bda

Browse files
committed
Fix type confusion in guc_var_compare()
Before this change guc_var_compare() cast the input arguments to const struct config_generic *. That's not quite right however, as the input on one side is often just a char * on one side. Instead just use char *, the first field in config_generic. This fixes a -Warray-bounds warning with some versions of gcc. While the warning is only known to be triggered for <= 15, the issue the warning points out seems real, so apply the fix everywhere. Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Reported-by: Erik Rijkers <er@xs4all.nl> Suggested-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/a74a1a0d-0fd2-3649-5224-4f754e8f91aa%40xs4all.nl
1 parent b020a86 commit 2cf9bda

File tree

1 file changed

+3
-3
lines changed
  • src/backend/utils/misc

1 file changed

+3
-3
lines changed

src/backend/utils/misc/guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5291,10 +5291,10 @@ find_option(const char *name, bool create_placeholders, int elevel)
52915291
static int
52925292
guc_var_compare(const void *a, const void *b)
52935293
{
5294-
const struct config_generic *confa = *(struct config_generic *const *) a;
5295-
const struct config_generic *confb = *(struct config_generic *const *) b;
5294+
const char *namea = **(const char ** const *) a;
5295+
const char *nameb = **(const char ** const *) b;
52965296

5297-
return guc_name_compare(confa->name, confb->name);
5297+
return guc_name_compare(namea, nameb);
52985298
}
52995299

53005300
/*

0 commit comments

Comments
 (0)