public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-493] [Ada] Fix thinko in QNX's implementation of __gnat_install_handler
@ 2022-05-16  8:44 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-16  8:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:839e7f16abda3fd8bd46d59ff1521d402d328a24

commit r13-493-g839e7f16abda3fd8bd46d59ff1521d402d328a24
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Mar 11 04:22:34 2022 +0000

    [Ada] Fix thinko in QNX's implementation of __gnat_install_handler
    
    On QNX, the sigaction handler is incorrectly installed via the
    sa_handler field of struct sigaction, rather than the sa_sigaction
    field. This triggers a compilation warning due to a mismatch between the
    function's signature and the field's type.
    
        | init.c:2614:18: warning: assignment to 'void (*)(int)'
        | from incompatible pointer type 'void (*)(int,  siginfo_t *, void *)'
        | {aka 'void (*)(int,  struct _siginfo *, void *)'}
        | [-Wincompatible-pointer-types]
    
    In practice, using the sa_handler field actually works, but only because
    those two fields are inside a union:
    
        From target/qnx7/usr/include/signal.h:
        | union { \
        |     __handler_type  _sa_handler; \
        |     __action_type   _sa_sigaction; \
        |     } __sa_un; \
    
    This commit fixes this.
    
    gcc/ada/
    
            * init.c (__gnat_install_handler) [__QNX__]: Set
            act.sa_sigaction rather than act.sa_handler.

Diff:
---
 gcc/ada/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 9eedffc4a37..4615cc152b2 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2611,7 +2611,7 @@ __gnat_install_handler (void)
   struct sigaction act;
   int err;
 
-  act.sa_handler = __gnat_error_handler;
+  act.sa_sigaction = __gnat_error_handler;
   act.sa_flags = SA_NODEFER | SA_SIGINFO;
   sigemptyset (&act.sa_mask);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-16  8:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  8:44 [gcc r13-493] [Ada] Fix thinko in QNX's implementation of __gnat_install_handler Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).