From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 74EC53858D3C; Sun, 21 Jan 2024 23:52:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74EC53858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705881123; bh=EYgwUWTIVIor6r8odCMXWBu9WAS5sH1OwudyFE9Swz4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=weJbyzyzfGDYTCJ5o9HEJEB53t8ZJB9mp2SgYxxkcfhsvzeSwCMDHqc629Sy/w1D8 iniGJkLBPhwlGod5hJfSplmOo7m+LC1e1+MfUIQyHWwduuiqBrGXSDo8zPbnivKqNJ F1lUo0wtu8iJGjbwZHqSiDtxuRUrS5FU+GLJt5LE= From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/113152] Fortran 2023 half-cycle trigonometric functions Date: Sun, 21 Jan 2024 23:52:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sgk at troutmask dot apl.washington.edu X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113152 --- Comment #14 from Steve Kargl = --- On Sun, Jan 21, 2024 at 09:52:39PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113152 >=20 > I think that you cannot do >=20 > + if (MPFR_HALF_CYCLE) >=20 > you really must use >=20 > #if MPFR_HALF_CYCLE >=20 #include #include "mpfr.h" #define MPFR_HALF_CYCLE (MPFR_VERSION_MAJOR * 100 + MPFR_VERSION_MINOR >=3D= 402) int main(void) { if (MPFR_HALF_CYCLE) printf("here\n"); else printf("there\n"); return (0); } % cc -o z -I/usr/local/include a.c && ./z here % cc -E -I/usr/local/include a.c | grep -v mpfr_ | grep -v gmp | cat -s ... int main(void) { if ((4 * 100 + 2 >=3D 402)) printf("here\n"); else printf("here\n"); return (0); } Are you sure that your testing is finding the right mpfr.h? If I add=20 #ifdef MPFR_VERSION_MAJOR #undef MPFR_VERSION_MAJOR #endif=20 #define MPFR_VERSION_MAJOR 3 above the define for MPFR_HALF_CYCLE in simplify.cc, it compiles for me. With this simple program real, parameter :: x =3D cospi(1.) print *,x end gdb ends up in the else { } branch. Breakpoint 1, gfc_simplify_cospi (x=3D0x803e24b60) at ../../gcc/gcc/fortran/simplify.cc:2085 2085 result =3D gfc_get_constant_expr (x->ts.type, x->ts.kind, &x->whe= re); (gdb) n 2101 mpfr_inits2 (2 * mpfr_get_prec (x->value.real), cs, n, r, NUL= L);=