From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 2C21D395BC48; Fri, 13 May 2022 12:55:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2C21D395BC48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 24DCs07x002970; Fri, 13 May 2022 07:54:01 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 24DCrxb5002967; Fri, 13 May 2022 07:53:59 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 13 May 2022 07:53:59 -0500 From: Segher Boessenkool To: Piotr Kubaj Cc: "Kewen.Lin" , gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: Re: [PATCH V2] powerpc: properly check for feenableexcept() on FreeBSD Message-ID: <20220513125359.GU25951@gate.crashing.org> References: <20220503102111.10406-1-pkubaj@FreeBSD.org> <20220512201637.GR25951@gate.crashing.org> <56585bab-71b3-1713-d8ed-bed80cfe5ec4@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 12:55:11 -0000 On Fri, May 13, 2022 at 12:34:05PM +0200, Piotr Kubaj wrote: > On 22-05-13 10:59:59, Kewen.Lin wrote: > > on 2022/5/13 04:16, Segher Boessenkool wrote: > > > On Tue, May 03, 2022 at 12:21:12PM +0200, pkubaj@FreeBSD.org wrote: > > >> FreeBSD/powerpc* has feenableexcept() defined in fenv.h header. > > > > > > Declared, not defined. These are required to be real functions (on all > > > platforms that have these functions), not macros or inlines or whatever. > > > > > > > Piotr's reply "FreeBSD doesn't have this function in libm, it's > > implemented in /usr/include/fenv.h." from [1] made me feel like > > it's a definition instead of declaration. So I thought the check > > should use AC_LINK_IFELSE instead, since one fenv.h which doesn't > > have the definition can still pass the proposed AC_COMPILE_IFELSE > > check. > > > > I just did a further search, the powerpc fenv.h [2] does include > > the definition of feenableexcept. By comparison, the x86 fenv.h [3] > > doesn't. But I'm not sure if it's the same as what Piotr's > > environments have. Hope it's similar. :-) > > > > [1] https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593193.html > > [2] https://github.com/freebsd/freebsd-src/blob/main/lib/msun/powerpc/fenv.h > > [3] https://github.com/freebsd/freebsd-src/blob/main/lib/msun/x86/fenv.h > > Yes, it's a definition and thanks for confirming that. As for why it's not in libm, I asked a developer about that: > 03:04 <@adalava> It shouldn't be difficulted but I moved to other thing after months looking at FPE in kernel, bugs in context switch and msun test cases failing :-P > > As far as I know, there are currently no plans to move it to libm on powerpc. riscv, arm and arm64 are in the same boat. > > I will follow with a next patch that will check for feenableexcept() in fenv.h if libm check is unsuccessful. FreeBSD's own documentation () says it is a function, and it suggests it is in the standard library even. This would be as expected, the same holds for the similar C standard functions. This does not provide an external definition, only a static inline (this is a good thing for a header file of course). You can take the address of a function. You also can interpose a real function normally, but that may not be relevant for FreeBSD, no idea. You can do neither with a static inline. So this should probably be fixed? Thanks for explaining the situation better! Segher