From patchwork Thu Jun 20 07:16:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1949943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=x1L6DlON; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W4WyK5Gbqz20X6 for ; Thu, 20 Jun 2024 17:16:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4F073888C58 for ; Thu, 20 Jun 2024 07:16:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4F073888C58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718867815; bh=gDU72bniGRozU148YGHmxyMZryceYqbj6T5Pw3VSXIQ=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=x1L6DlONKKEfwfmekq0D3sUuG9yJPA/Zf6izqg9rm21LBrXGaFAiuIwBl5ftc7XC2 HNlruYVp9kDbZb7mbSUwCLLMILdbnz51AK+rjUApplXBt0DOqqjPaZtOoigO0ujRZN hyR9pTi8spbm38wOQYryMfTMY4xZpofXegmQJ5t0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by sourceware.org (Postfix) with ESMTPS id BCBF33887008; Thu, 20 Jun 2024 07:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCBF33887008 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BCBF33887008 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718867788; cv=none; b=JUeFCbtZAMkffLRYlyVrYWCJZhjMIetkVpZ//u3fWSVk1zKTOILceKAHsnPfFO8FkRAB60DgFEV7S59Oeod90QbubTZYQaPjLKKRwLhj+lOH9tOWY7WUZTl2PUo+sWGg2Yqg2kzwT3FaxJuFOQLo7j7ktWDWpGFrXaseFrvNhIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718867788; c=relaxed/simple; bh=muikGHqoX/4DgdmO9j58qiWaZzo8Z1fRk+t/XeJTBXg=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=n7ogFLSnW5nGtenupsnTG+EVTmpvE9LtIGqL0LLfVCdokZNqMUs7eTFuQfaYSeO+w8g9nIHW3wh98SAjG3oq2txuTmWwkkMob/Ujeh54kbsdOK3oLPcpv/e6X2WRQgrQwUrPMQLr1U7jnFyIyQm4B0rIm8SjjRZyG9emRv/4kh0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-70627716174so527285b3a.3; Thu, 20 Jun 2024 00:16:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718867784; x=1719472584; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gDU72bniGRozU148YGHmxyMZryceYqbj6T5Pw3VSXIQ=; b=JE5yW5EgGLLFXbwifNHArBCcY/2uhwfd0Auvm5JI1Fw0UoE3I+5QR9b9fcpnC3KY8B bxiNPDUvFcaB9cz3LFDAIhynzhU4H4mIfnr1dERnkox62TS76a/0Es8qw7FU0YPt5wAB /xJ3LSTm1rRS1OLxUZpXCzgQ/VW8gM09WXfUceSdYhiW+XXNT+VAuuyE1pUpTz5J7Jra VrwtWZb9nKZql12VRLq6qy4iSePPOoEWzhiAUIieco1A0VHxzF1dbiSWb+RHbgAUd70k VDAmZvr5KblejmeKsLFcwQWngHFOIKZC8iaYA4qy91koXgdCCmRyQ7UWWBNHExNOpfva QkOg== X-Gm-Message-State: AOJu0YzbVWbwBZNrey3JeCvF5vTjzOLYrMzOFBeJmaCTZDDK+tKcYt1A w+iiESXpOQIUAlz6bJt0/H9JPO9CP2uS+LAgWA7UrOR/En0OGUrLG3u/Yy6e X-Google-Smtp-Source: AGHT+IHlF1/yVciPjF2EtzITR3xabI1gi8uXS7vcvLcxdjxnc0AzDVUoeS7RwpXC3kVlYbmFg5eQ1Q== X-Received: by 2002:a05:6a20:7b27:b0:1b7:85a:c2b3 with SMTP id adf61e73a8af0-1bcbb3dd258mr3846743637.8.1718867784334; Thu, 20 Jun 2024 00:16:24 -0700 (PDT) Received: from localhost.localdomain ([194.169.55.179]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9c9ad92d2sm8431955ad.245.2024.06.20.00.16.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 20 Jun 2024 00:16:24 -0700 (PDT) From: YunQiang Su To: gcc-patches@gcc.gnu.org Cc: YunQiang Su Subject: [PATCH] testsuite/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS Date: Thu, 20 Jun 2024 15:16:17 +0800 Message-Id: <20240620071617.61040-1-syq@gcc.gnu.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org The DIV instructions of MIPS won't be trapped themself if the divisor is zero. The compiler will emit a conditional trap instruct for it. So the signal will be SIGTRAP instead of SIGFPE. gcc/testsuite * c-c++-common/ubsan/overflow-div-3.c: Use SIGTRAP for MIPS. --- gcc/testsuite/c-c++-common/ubsan/overflow-div-3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/ubsan/overflow-div-3.c b/gcc/testsuite/c-c++-common/ubsan/overflow-div-3.c index 479dffb0304..eef58aca832 100644 --- a/gcc/testsuite/c-c++-common/ubsan/overflow-div-3.c +++ b/gcc/testsuite/c-c++-common/ubsan/overflow-div-3.c @@ -7,6 +7,11 @@ #include int cnt; +#ifdef __mips + int sig = SIGTRAP; +#else + int sig = SIGFPE; +#endif __attribute__((noipa)) int foo (int x, int y) @@ -30,7 +35,7 @@ main (void) sigemptyset (&s.sa_mask); s.sa_handler = handler; s.sa_flags = 0; - sigaction (SIGFPE, &s, NULL); + sigaction (sig, &s, NULL); volatile int a = foo (42, 0); cnt++; volatile int b = foo (INT_MIN, -1);