From patchwork Mon May 16 08:43:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54016 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 178A53857823 for ; Mon, 16 May 2022 09:01:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 178A53857823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652691699; bh=qAJbTxkwTxaAouDkKDLGsAEngYKOMrk87R+ZX8WzLUg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Tr+ZQILLVaKkdRqxw1wWUKeuUVAMPfbLPQAZf+YRYyVb8CrXlIVaEs754F+lzyDS6 sYfxSO5rJafCrU2JwpPiK0adeFoxEbgxK8Rc0ok0xre7tKIl9boUPd94j+T+MYPPrK wje/BlZyJzd5Y8tO6nC8TaTekYAD2pJY1ZwHW+jo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id AEA53385734B for ; Mon, 16 May 2022 08:43:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AEA53385734B Received: by mail-wm1-x329.google.com with SMTP id k26so454154wms.1 for ; Mon, 16 May 2022 01:43:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=qAJbTxkwTxaAouDkKDLGsAEngYKOMrk87R+ZX8WzLUg=; b=bEP+hK2jKGPrF0BRRB4ScZKmhwVFhjFSwsk69/jn+DXNF9nXqmmBJGUp+oxbaJQHqV Q88RZABSm8jmM4vlsvo5ZQ20eXVEwctA3/5P5ds9uGTvJ3Rygk3XCcSxOHdcOIH1AM/m QxMfePzgOldWjrrqltLdDlBpGQRcD4+Nr1t6aCWz93I7NdW4qCrb4XUHfWWKNtuz0XGk kWCLyHOh8hlAT+NYl9LNmuMOj1f0NTg5gHyy2Bc2ZUjiXQ6aEzZqWlHWZvfIDcfkG4VU mmUgZp162fzfpD0+4CU/xbtGwxdJv7eyMNj8BuP0HkLBY6dEnuBW0zzsxHq2D4UNFemG PDdQ== X-Gm-Message-State: AOAM533SnDBJQJ+Web0q41mlx2LBYAz2J/DMqt60DrZYtK0XMFWc6YY4 OMxoT+ulSFZPjeOiq5YTIQQhhenuKeHA9A== X-Google-Smtp-Source: ABdhPJxtwyAX3XY2zCgv86i8ZAxy/Vb6+QQI5qwyipT7YnG78N79gav6BdXCc3DmAtmKvfIzoFNz7w== X-Received: by 2002:a7b:c017:0:b0:394:5631:62bc with SMTP id c23-20020a7bc017000000b00394563162bcmr26580693wmb.190.1652690594559; Mon, 16 May 2022 01:43:14 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id 4-20020a05600c26c400b003942a244eeasm9189764wmv.47.2022.05.16.01.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 01:43:14 -0700 (PDT) Date: Mon, 16 May 2022 08:43:13 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix thinko in QNX's implementation of __gnat_install_handler Message-ID: <20220516084313.GA3843684@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Joel Brobecker Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * init.c (__gnat_install_handler) [__QNX__]: Set act.sa_sigaction rather than act.sa_handler. diff --git a/gcc/ada/init.c b/gcc/ada/init.c --- 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);