From nobody Sat Dec 11 14:15:33 2021 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7EF818DB841 for ; Sat, 11 Dec 2021 14:16:10 +0000 (UTC) (envelope-from m.e.sanliturk@gmail.com) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JB8vZ3fNLz3hKC for ; Sat, 11 Dec 2021 14:16:10 +0000 (UTC) (envelope-from m.e.sanliturk@gmail.com) Received: by mail-wr1-x430.google.com with SMTP id q3so19527913wru.5 for ; Sat, 11 Dec 2021 06:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CpPVEseFrcK0hVW3+SMhfA1s8D8ijXyccQNPKVdZz9Y=; b=IlKHk79v9ESK8VDoyAJ1Qq7Bd9gDQOpnRjo0vUXUe5IIEdDt0ZJYk665dXF/xH3o6v avoNL8t9z9+y1EqckCzpjA6om01Ibkmx3C2sTtShFK+zPtrUH0mrE0f4UIYDqmcsd8Dw S2uzvfM49yNNZ1Q6AE+2XtNRtWR+ujUL6C3mDyOQmlJNYPiL0wP1uXGBZOOdSWeJ3w8L mUURrZGHNPldlWGpUdAKqMEFttCD0aDkiY8r9jSy0cfUR7neRC1EhgbyIMaVlh5okWRw zE3tie5uQWESC+e9ugarQJB2/YhSGA9PdD9a6r1ShBCA3zn6eQHQXx8Ft84S2ZbiaMI7 7cqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CpPVEseFrcK0hVW3+SMhfA1s8D8ijXyccQNPKVdZz9Y=; b=Gle+fJAPSoqJoKfg1uRM5uDJQMYkHZtleRenToSaOeyRokEd+gBWVLlk8/5YKFiL0n F/phVmzZp3FvrPR4LeSzSKDT3w25o2R+8kCcYip4FINEvpGibHbbCJxzgqyugOQcz8+V 14tFQrPpf7h/C/1MDo8Gw+hAHX1biY1R/m8YIe8P70GGbeJPWh+KcThbX1QMZVjlBZGv vctFwiGV/fAm6pxlAize9cNceI6S33nLyEzHBopmOvGeeCpLd0HQEbGoCG6KtQeTGF95 yXKUalhbuAXmzT+0P7bp1ywH9frFgq+Q5UgRG1fRJxnboUOKNJ3JzZCvEbGbCmJtOcKx nBDg== X-Gm-Message-State: AOAM532U8ti2zVswXBlgkoawImamzF5AzIl45KEdMTjMpTl7q44eDdbc KXmI39rkwqnuNLyLEndxZarPLFTgJwsFt5fFdvnefGObGLA= X-Google-Smtp-Source: ABdhPJydY6HbJz+i7M78hEwgtxSSP6STIbXeoPF8InwyFP+eRqveCfpQ/NQMYhxMPYuY42k2o7DWLsVe9HVdyKHSKm4= X-Received: by 2002:adf:ed52:: with SMTP id u18mr20410561wro.609.1639232169492; Sat, 11 Dec 2021 06:16:09 -0800 (PST) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: <2A944692-2C5A-4AF0-9E26-34C2142C5E3E@lafn.org> In-Reply-To: From: Mehmet Erol Sanliturk Date: Sat, 11 Dec 2021 17:15:33 +0300 Message-ID: Subject: Re: Fortran exceptions To: Daniel Feenberg Cc: Doug Hardie , FreeBSD Questions Mailing List Content-Type: multipart/alternative; boundary="0000000000002ac4d505d2df7b99" X-Rspamd-Queue-Id: 4JB8vZ3fNLz3hKC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000002ac4d505d2df7b99 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 11, 2021 at 4:46 PM Daniel Feenberg wrote: > > On Fri, 10 Dec 2021, Doug Hardie wrote: > > > =EF=BB=BFI have a fairly large fortran program that I am trying to run = on flang. > > It almost works, but I am sure there are a few typos in it. I had to > > enter it by hand from a large listing. When it encounters a STOP, it > > displays several ieee exception messages. Unfortunately there is no wa= y > > to identify where those occurred. How can I get the runtime to stop > > when an exception occurs. This is on FreeBSD 13.0 release with whateve= r > > flang is in the ports. > > I have found valgrind helpful with gfortran - I don't know if it works > with flang. > > https://valgrind.org/docs/manual/manual-core.html#manual-core.whatdoe= s > > Flang can apparently generate code suitable for the gdb debugger, which > can be useful. > > https://www.sourceware.org/gdb/ > https://undo.io/resources/debugging-fortran-code-gdb/ > https://www.scivision.dev/fortran-debugging-gdb/ > > > Finally, if you can use gfortran, there are many options to improve > runtime checking. You might be interested in --fpe-trap. > > https://gcc.gnu.org/onlinedocs/gfortran/Debugging-Options.html > > As far as I can tell, flang has no equivalents, but I haven't used flang. > It wouldn't install for me from ports or pkg's. Both complained my versio= n > of Freebsd (12.1) was unsuitable. > > Back in the 1970s there used to be the Watfor-77 compiler for the IBM 360= , > and later for Windows, which would check for uninitalized variables, > subscripts out of range, type mismatches in subroutine calls, etc and > provide a clear error message with no need to interpret hex constants. Bu= t > compiler writers don't like to provide what they consider to be crutches > for people less competent than themselves, so runtime error checking is > usually neglected, sometimes vigorously. The IBM Fortran G compiler I > first used in 1972 ran in 16K and provided a better error traceback than > any currently available compiler I am familiar with except one: > > https://www.silverfrost.com/ > > Silverfrost does detect and report most runtime errors, but it is Windows > only. Worth the money for many users, if you can stand working in > Windows. The debugged program can go back to FreeBSD. > > This question might better go in a fortran-specific mailing list: > > https://groups.google.com/g/comp.lang.fortran > https://fortran-lang.discourse.group/ > > Daniel Feenberg > NBER I have used the Silverfrost free compiler for many years in the past . It is an usual compiler in the following sense : It is giving errors in many syntaxes which are not errors in Fortran . For example ( from MEMORY after many years , but concepts are true ) : Double Precision X , Y . . . If ( X .EQ. Y ) ... Error : In floating point , equality of X and Y may not be possible due to trailing bits generated randomly in electronic circuits Then , "correct" statement is : If ( DABS ( X - Y ) .LT. 1.0D-100 <--------- A threshold value or variable for ZERO ... ) ... And other such very useful messages which related to the "pitfalls" of possible , undetectable errors by "eye" . This means that , a program compiled with Silverfrost and run ( its run time errors are corrected ) is likely that it will work correctly when compiled with other compilers in any operating system . Especially "thank you" to Daniel Feenberg for his very nice message . With my best regards , Mehmet Erol Sanliturk --0000000000002ac4d505d2df7b99--