JDK-8294594 : Fix cast-function-type warnings in signal handling code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 20
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2022-09-29
  • Updated: 2022-10-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20Unresolved
Description
After JDK-8294314, we would have signals_posix.cpp excluded with cast-function-type warning:

```
/home/shade/trunks/jdk/src/hotspot/os/posix/signals_posix.cpp: In function 'int SR_initialize()':
/home/shade/trunks/jdk/src/hotspot/os/posix/signals_posix.cpp:1727:20: error: cast between incompatible function types from 'void (*)(int, siginfo_t*, ucontext_t*)' to 'void (*)(int)' [-Werror=cast-function-type]
 1727 |   act.sa_handler = (void (*)(int)) SR_handler;
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
```

A closer look would reveal that we are using the wrong slots for SR_handler, `sa_handler` vs `sig_handler`, which manifests in type cast errors. `man sigaction` says:

```
       If SA_SIGINFO is specified in sa_flags, then sa_sigaction (instead  of  sa_handler)  specifies  the  signal-handling
       function for signum.  This function receives three arguments, as described below.
```
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/10494 Date: 2022-09-29 16:12:11 +0000
29-09-2022