Bug 2336278

Summary: alsa-tools fails to build with C23 ("new_process.c:67:18: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]")
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: alsa-toolsAssignee: Tim Jackson <rpm>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: jkysela, rpm
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2333037    

Description Dave Malcolm 2025-01-07 23:56:09 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476073/

whereas my test build with GCC 14 succeeded:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8477652/

Looking at the failure logs e.g.
https://download.copr.fedorainfracloud.org/results/dmalcolm/gcc-15-smoketest-3.failed/fedora-rawhide-x86_64/08476073-alsa-tools/builder-live.log.gz

I see:

In file included from profiles.c:32:
new_process.c: In function 'new_process':
new_process.c:67:18: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
   67 |         int_stat = signal(SIGINT, SIG_IGN);
      |                  ^
new_process.c:68:19: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
   68 |         quit_stat = signal(SIGQUIT, SIG_IGN);
      |                   ^
new_process.c:69:19: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
   69 |         usr2_stat = signal(SIGUSR2, SIG_IGN);
      |                   ^
new_process.c:81:24: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
   81 |         signal(SIGINT, int_stat);
      |                        ^~~~~~~~
      |                        |
      |                        void (*)(void)
In file included from envy24control.h:4:
/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
new_process.c:82:25: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
   82 |         signal(SIGQUIT, quit_stat);
      |                         ^~~~~~~~~
      |                         |
      |                         void (*)(void)
/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
new_process.c:83:25: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
   83 |         signal(SIGUSR2, usr2_stat);
      |                         ^~~~~~~~~
      |                         |
      |                         void (*)(void)
/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~


This is probably due to GCC 15 now defaulting to -std=gnu23, whereas GCC 14 defaulted to -std=gnu17, and C23 is stricter about function prototypes than C17.  It's probably fixable by fixing the function prototypes (or by manually adding -std=gnu17 to the C build flags)



Reproducible: Always

Comment 1 Aoife Moloney 2025-02-26 13:21:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.