From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ABB853857C52; Fri, 14 Aug 2020 15:58:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABB853857C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597420724; bh=kStP8mZcn74C81OJpyv3GsK06OW7LCDX8EQIhrm0dvk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X59+oJV2Kjq9vrmJzvOhxHDkssAVgWfesvzPvAlvn4yOP1tVyPVpTH1QxF0e2Xzt6 Lld4qVJxr23qqZu4m7I0003J0uyx0hIYL+xHVBfMw0BbJE1Zgysa8EwPEwxc30Wn3/ x2DI6ZJUehmTFPCGWfqICLbtqXcm5+sFKjt5bqd4= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/96613] SIGFPE on min1() with -ffpe-trap=invalid switch Date: Fri, 14 Aug 2020 15:58:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org 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: bug_status cf_reconfirmed_on everconfirmed cc priority 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2020 15:58:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96613 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-08-14 Ever confirmed|0 |1 CC| |kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #1 from kargl at gcc dot gnu.org --- Compiling with -fdump-tree-original gives integer(kind=3D4) ix; real(kind=3D4) x; x =3D 7.7643945e+9; { integer(kind=3D4) M.0; M.0 =3D 5000; M.0 =3D MIN_EXPR <(integer(kind=3D4)) x, M.0>; ix =3D M.0; } The MIN_EXPR is clealy a bad idea as x > huge(1). The Fortran standard states, that for example, MIN1(a,b) =3D INT(MIN(a,b)). I would have expected to see something along the lines of integer(kind=3D4) ix; real(kind=3D4) x; x =3D 7.7643945e+9; { real(kind=3D4) M.0; M.0 =3D 5000.0; M.0 =3D MIN_EXPR ; ix =3D (integer(kind=3D4)) M.0; } If this is effecting your code, I suggest changing it to min1() =3D int(min()) to work around the issue. This might get fixed someday when a gfortran contributor has time to look at it.=