From patchwork Sat May 8 17:43:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1475900 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=gM/FpZNx; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FcvnT23dzz9vFT for ; Sun, 9 May 2021 03:43:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 01B66388CC1E; Sat, 8 May 2021 17:43:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id C007B3833031 for ; Sat, 8 May 2021 17:43:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C007B3833031 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=botcazou@adacore.com Received: by mail-wm1-x336.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso8819909wmh.4 for ; Sat, 08 May 2021 10:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=78Oztin7h1WnAXICPki0azzw7RV+sUAjJg4I5AHFGIY=; b=gM/FpZNxHt6nsg9arQJGbGf92AfE5lX61lRlff2RahN3HH0wyEdrEuj6PyC46W5hxA 29b0kChDQpDVN7brg6yr+HOQn/r/GBMTCny0RBQxvsYk2VEsuC/yMXGN4pYiNp8rDxrV qqIzcWhPKKbW8iAgjCBvGWzrTrYE5ONHKsXNfWeP5BxHrSyOYEd08LZ9Pj/JHnAHNLTH Gd7kOgUdp7+spJcDfk5qiaZE34cffAMaRZ5KOW1ZZANmPq6FAchgUL5o6H/GHmdaeR1N nTsM6KFpIY4iulKLGWk8iCF62Wr+Nqk1TaiqvwO2iluCQ6TzLGUkmcc7y6YTc9jEv7oh t0tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=78Oztin7h1WnAXICPki0azzw7RV+sUAjJg4I5AHFGIY=; b=mU19Q4k6jDVxPsF8uGpCRQi4Iu3QJObxubt00MBUkV/wUVlE8b16mlDmKn+2nvtUi+ O2jIZQGWhFIWWECPKArE7eF4+D7Kfhb5NnLSlMpgdV/QKjviaiDcpwLu2G9EIwwjr7Ip 7Awc17sAtkVHD6Vj3iHo9dJfxKewhIEMoLPOAoVYYePSJSDpbM0dnvqjkHfRrkZRr5gG PfRKfVbORPTIiPNHYZ/V/1s4ryOHdDKY1A6bYGzNnVFw76HXmJvLNVY8E+e4a4ySA55e rIX90jJuKNFUD+NTzYbdCX/zk0mfSy7v9THNgQTUwDihwm7Pj9Ot2YnBvYlCd9MDxrG6 GIVA== X-Gm-Message-State: AOAM5328XiVKg5KdAKyaTzW6hcyiC+8H6fFoRVHsR+pyXMzTU1la154/ EXHI9KUG8DH9wlExq3Xdy/ooS8v/Rq2JrtL6 X-Google-Smtp-Source: ABdhPJz0vAtFu0Le1QS2/rY3P7o8YeSyOlaCzot4s5Ha9DktxGURBl/8lT8tt0OU5btWtQFnzSAHlA== X-Received: by 2002:a05:600c:1192:: with SMTP id i18mr22505435wmf.166.1620495827663; Sat, 08 May 2021 10:43:47 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id r5sm13512265wmh.23.2021.05.08.10.43.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 10:43:46 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Remove call to gcc_unreachable in range-op.cc Date: Sat, 08 May 2021 19:43:45 +0200 Message-ID: <1782395.tdWV9SEqCh@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, the attached Ada testcase happens to stumble on the call to gcc_unreachable in operator_bitwise_xor::op1_range. My understanding is that there is nothing wrong going on and that it's safe to let it go through. Tested on x86-64/Linux, OK for mainline and 11 branch? 2021-05-08 Eric Botcazou * range-op.cc (get_bool_state): Adjust head comment. (operator_not_equal::op1_range): Fix comment. (operator_bitwise_xor::op1_range): Remove call to gcc_unreachable. 2021-05-08 Eric Botcazou * gnat.dg/specs/opt5.ads: New test. * gnat.dg/specs/opt5_pkg.ads: New helper. diff --git a/gcc/range-op.cc b/gcc/range-op.cc index ab8f4e211ac..742e54686b4 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -358,10 +358,8 @@ range_true_and_false (tree type) enum bool_range_state { BRS_FALSE, BRS_TRUE, BRS_EMPTY, BRS_FULL }; -// Return the summary information about boolean range LHS. Return an -// "interesting" range in R. For EMPTY or FULL, return the equivalent -// range for TYPE, for BRS_TRUE and BRS false, return the negation of -// the bool range. +// Return the summary information about boolean range LHS. If EMPTY/FULL, +// return the equivalent range for TYPE in R; if FALSE/TRUE, do nothing. static bool_range_state get_bool_state (irange &r, const irange &lhs, tree val_type) @@ -383,6 +381,7 @@ get_bool_state (irange &r, const irange &lhs, tree val_type) r.set_varying (val_type); return BRS_FULL; } + return BRS_TRUE; } @@ -538,7 +537,7 @@ operator_not_equal::op1_range (irange &r, tree type, break; case BRS_FALSE: - // If its true, the result is the same as OP2. + // If it's false, the result is the same as OP2. r = op2; break; @@ -2643,7 +2642,7 @@ operator_bitwise_xor::op1_range (irange &r, tree type, r = op2; break; default: - gcc_unreachable (); + break; } return true; }