Bug 1224533 - Package alpine does not build with gcc 14 because of a call arguments with an incompatible pointer type
Summary: Package alpine does not build with gcc 14 because of a call arguments with an...
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Reinhard Max
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: modern_C
  Show dependency treegraph
 
Reported: 2024-05-20 13:34 UTC by Martin Jambor
Modified: 2024-06-05 08:29 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jambor 2024-05-20 13:34:19 UTC
Package alpine fails to build with gcc 14, which newly treats as
errors a number of situations which before were mere warnings.  More
information can be found at https://gcc.gnu.org/gcc-14/porting_to.html
and in bug #1220571.

The failure can be seen online for example at
https://build.opensuse.org/package/live_build_log/home:rguenther:plgrnd/alpine/openSUSE_Factory/x86_64
and be reproduced locally with osc build --clean --alternative-project
home:rguenther:nextgcc

The error which stops the build is:

[   68s] adrbklib.c: In function ‘sort_addr_list’:
[   68s] adrbklib.c:4705:64: error: passing argument 4 of ‘qsort’ from incompatible pointer type [-Wincompatible-pointer-types]
[   68s]  4705 |     qsort((qsort_t *)list, (size_t)(p - list), sizeof(char *), cmp_addr);
[   68s]       |                                                                ^~~~~~~~
[   68s]       |                                                                |
[   68s]       |                                                                int (*)(const char *, const char *)
[   68s] In file included from ../include/system.h:42,
[   68s]                  from ../pith/headers.h:25,
[   68s]                  from adrbklib.c:14:
[   68s] /usr/include/stdlib.h:971:34: note: expected ‘__compar_fn_t’ {aka ‘int (*)(const void *, const void *)’} but argument is of type ‘int (*)(const char *, const char *)’
[   68s]   971 |                    __compar_fn_t __compar) __nonnull ((1, 4));


Interestingly, I while I find see Gentoo and Fedore bugs (see the
links in the meta bug) about alpine not compiling with compilers with
this strict behavior, none of them look like the issue above.
Comment 1 Reinhard Max 2024-05-21 13:06:37 UTC
Hmm, alpine even has a configure check to see whether qsort() wants the comparison function to take (void *) or (char *) arguments, but something in there seems to go wrong. Investigating ...
Comment 2 Reinhard Max 2024-05-21 13:18:55 UTC
Ah, the check makes use of implicit int which is now also an error and lets the check for (void *) fail leading to the assumption that (char *) is needed for qsort():

configure:23571: checking argument pointer type of qsort compare function and base
configure:23600: gcc -c [...] conftest.c
conftest.c:141:8: error: type defaults to 'int' in declaration of 'sortf' [-Wimplicit-int]
  141 | extern sortf(const void *, const void *);
      |        ^~~~~
[...]
configure: failed program was:
[...]
| extern void *base;
| extern sortf(const void *, const void *);
| int sortf(a, b)
|   const void *a;
|   const void *b; { return 0; }
[...]
configure:23611: result: char
Comment 3 Reinhard Max 2024-05-21 13:33:18 UTC
Yep, that prototype should be

 extern int sortf(const void *, const void *);

and after fixing it there are no further errors with gcc 14.
Comment 5 Reinhard Max 2024-06-05 08:29:25 UTC
Oops, I posted comment 4 to the wrong bug, but anyway, a fixed version of alpine is now in Factory, and so this ticket can remain closed.