From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by sourceware.org (Postfix) with ESMTPS id 740273858C74 for ; Thu, 8 Jun 2023 14:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 740273858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-19f454bd2c8so616885fac.3 for ; Thu, 08 Jun 2023 07:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686235062; x=1688827062; h=mime-version:user-agent:message-id:date:errors-to:organization :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=JDnOAvIEwoqHdrtlQhX/kpkBGgZFtQ8cdjDi62KQ1xk=; b=L4JX/gg+J5V06aZGe6gRCdVw6zmzVGyEWKkN/Vt1dC2OM68hHZTZfJvpER/EBXVaXC Ziv6a+TaFeXIWAIK74/oyig9nU6D7J0HqZ5XX7qxEKxpK+PuYU5DrSHFsTRvxBVNu1Ci 3q+WRSUhIx1ri5J9T+QyHhIkwaSgOZvETYxhaa83vgtT28Gir9a4iAecrGjYoxD5vC4l MLuar+QqKMhMtxYm+YA+buLWSmG2mzdAHKYUEGlDVzJp6vLsxOTsg1JqouVkqIMCZTOD OfTuBLQwo6s9APcOm4F1s0UHDSlW3WPNOFWURxjiZUHVxU6aiSB/Yako9K7u7GG7+vc4 zp4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686235062; x=1688827062; h=mime-version:user-agent:message-id:date:errors-to:organization :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JDnOAvIEwoqHdrtlQhX/kpkBGgZFtQ8cdjDi62KQ1xk=; b=H9jYysz+ibvGn/MYpx0GkeilCcKAYUyEYKLS+kTBO4CPIWYvaqWBbldp0EW4VpwAv7 scT9lsT9/eTIAT9BhXeMFLSOfLN16VR6emRIjdlC31hP5ah+fq32azhrorWdbNl478G5 neg7dIIqB/qfH7GwBE5bTTWrY3l7THTzKu7i2VRi+zO+gKRSs1fxh6HkRwNt+bseoAzT spcgm3CuF/0ySBfdyd5QGR+x7xLS6uIAO/imlPYFvSRT3ushFAs8rIsnHnW5iZ1loeig EYbOepTqxS0jO4jTiehWWpnmUeSKqWDqyTz15wXZ5vNa6KWC+6Ce9ylpy3TmVfyXNZjj LFKw== X-Gm-Message-State: AC+VfDzUYB7KveglcAS/aWi5U9HLgexsBeXGGj8WNdtCdqAvuruXBsxi WsBBHqjUyuKH0W7tH5LL+/0loA9cFBNw9hBDXqs= X-Google-Smtp-Source: ACHHUZ4cnQmamZSBqCsE7ZDh5APP7SPPI6v8dtgvDvjaWVp3WLou9JRYhFHVPlFiSvIVW3FAEWAEcA== X-Received: by 2002:a05:6870:9204:b0:191:89b3:6f46 with SMTP id e4-20020a056870920400b0019189b36f46mr6983704oaf.38.1686235062708; Thu, 08 Jun 2023 07:37:42 -0700 (PDT) Received: from free.home ([2804:7f1:2080:a74a:92d8:3534:d404:8561]) by smtp.gmail.com with ESMTPSA id ot8-20020a056870cc8800b001807f020a39sm852518oab.12.2023.06.08.07.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 07:37:42 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 358EbUps033379 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 8 Jun 2023 11:37:31 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [PATCH] fix frange_nextafter odr violation Organization: Free thinker, does not speak for AdaCore Errors-To: aoliva@lxoliva.fsfla.org Date: Thu, 08 Jun 2023 11:37:30 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.6 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 List-Id: C++ requires inline functions to be declared inline and defined in every translation unit that uses them. frange_nextafter is used in gimple-range-op.cc but it's only defined as inline in range-op-float.cc. Drop the extraneous inline specifier. Other non-static inline functions in range-op-float.cc are not referenced elsewhere, so I'm making them static. Bootstrapping on x86_64-linux-gnu, along with other changes that exposed the problem; it's already into stage3, and it wouldn't get past stage2 before. Ok to install? for gcc/ChangeLog * range-op-float.cc (frange_nextafter): Drop inline. (frelop_early_resolve): Add static. (frange_float): Likewise. --- gcc/range-op-float.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index a99a6b01ed835..d6da2aa701ee3 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -255,7 +255,7 @@ maybe_isnan (const frange &op1, const frange &op2) // Floating version of relop_early_resolve that takes into account NAN // and -ffinite-math-only. -inline bool +static inline bool frelop_early_resolve (irange &r, tree type, const frange &op1, const frange &op2, relation_trio rel, relation_kind my_rel) @@ -272,7 +272,7 @@ frelop_early_resolve (irange &r, tree type, // Set VALUE to its next real value, or INF if the operation overflows. -inline void +void frange_nextafter (enum machine_mode mode, REAL_VALUE_TYPE &value, const REAL_VALUE_TYPE &inf) @@ -2878,7 +2878,7 @@ namespace selftest // Build an frange from string endpoints. -inline frange +static inline frange frange_float (const char *lb, const char *ub, tree type = float_type_node) { REAL_VALUE_TYPE min, max; -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about