Bugzilla – Bug 1221007
GCC 14: mariadb-connector-c package fails
Last modified: 2024-03-08 10:53:02 UTC
Building mariadb-connector-c with GCC 14 fails here: https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/mariadb-connector-c/standard/x86_64 Due to: mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c: In function ‘ma_rio_open’: mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c:282:41: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 282 | if (!(file = (MA_FILE *)calloc(sizeof(MA_FILE), 1))) | ^~~~~~~ mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c:282:41: note: earlier argument should specify number of elements, later size of each element mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c:286:56: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 286 | if (!(file->ptr= rf= (MA_REMOTE_FILE *)calloc(sizeof(MA_REMOTE_FILE), 1))) | ^~~~~~~~~~~~~~ mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c: In function ‘bulk1’: mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c:77:43: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 77 | lengths= (unsigned long *)calloc(sizeof(long), TEST_ARRAY_SIZE); | ^~~~ mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c:77:43: note: earlier argument should specify number of elements, later size of each element mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c:78:39: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 78 | vals= (unsigned int *)calloc(sizeof(int), TEST_ARRAY_SIZE); | ^~~ mariadb-connector-c-3.3.8-src/unittest/libmariadb/ps_bugs.c: In function ‘test_maxparam’: mariadb-connector-c-3.3.8-src/unittest/libmariadb/ps_bugs.c:5162:24: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 5162 | bind = calloc(sizeof(MYSQL_BIND), 65535); | ^~~~~~~~~~ mariadb-connector-c-3.3.8-src/unittest/libmariadb/ps_bugs.c:5162:24: note: earlier argument should specify number of elements, later size of each element Builds with automatically generated: Index: mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c =================================================================== --- mariadb-connector-c-3.3.8-src.orig/plugins/io/remote_io.c +++ mariadb-connector-c-3.3.8-src/plugins/io/remote_io.c @@ -279,11 +279,11 @@ MA_FILE *ma_rio_open(const char *url,con MA_REMOTE_FILE *rf; (void)operation; - if (!(file = (MA_FILE *)calloc(sizeof(MA_FILE), 1))) + if (!(file = (MA_FILE *)calloc(1, sizeof(MA_FILE)))) return NULL; file->type= MA_FILE_REMOTE; - if (!(file->ptr= rf= (MA_REMOTE_FILE *)calloc(sizeof(MA_REMOTE_FILE), 1))) + if (!(file->ptr= rf= (MA_REMOTE_FILE *)calloc(1, sizeof(MA_REMOTE_FILE)))) { free(file); return NULL; Index: mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c =================================================================== --- mariadb-connector-c-3.3.8-src.orig/unittest/libmariadb/bulk1.c +++ mariadb-connector-c-3.3.8-src/unittest/libmariadb/bulk1.c @@ -74,8 +74,8 @@ static int bulk1(MYSQL *mysql) /* allocate memory */ buffer= calloc(TEST_ARRAY_SIZE, sizeof(char *)); - lengths= (unsigned long *)calloc(sizeof(long), TEST_ARRAY_SIZE); - vals= (unsigned int *)calloc(sizeof(int), TEST_ARRAY_SIZE); + lengths= (unsigned long *)calloc(TEST_ARRAY_SIZE, sizeof(long)); + vals= (unsigned int *)calloc(TEST_ARRAY_SIZE, sizeof(int)); for (i=0; i < TEST_ARRAY_SIZE; i++) { Index: mariadb-connector-c-3.3.8-src/unittest/libmariadb/ps_bugs.c =================================================================== --- mariadb-connector-c-3.3.8-src.orig/unittest/libmariadb/ps_bugs.c +++ mariadb-connector-c-3.3.8-src/unittest/libmariadb/ps_bugs.c @@ -5159,7 +5159,7 @@ static int test_maxparam(MYSQL *mysql) MYSQL_STMT *stmt= mysql_stmt_init(mysql); MYSQL_BIND* bind; - bind = calloc(sizeof(MYSQL_BIND), 65535); + bind = calloc(65535, sizeof(MYSQL_BIND)); rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); check_mysql_rc(rc, mysql);
Thank you for the report and the fix. I have submitted a patch to TW: https://build.opensuse.org/request/show/1156328