From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 47C7B3857B96 for ; Wed, 1 Jun 2022 11:46:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 47C7B3857B96 Received: by mail-pg1-x52b.google.com with SMTP id 129so1686248pgc.2 for ; Wed, 01 Jun 2022 04:46:42 -0700 (PDT) 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=OdC8Xe6pBchie6MD+ibb2UXqeAJth89V45DFNArT7sg=; b=lCB8sPGBCnA4NH728IyuKUY1ygutuY0atL7ZnzOqxxanjURb6WH3IuSbHnMkHch+F8 5NJ2ev/7rjk92ytrVLqY+KByLJEkTHM1vnt/RnR6ouUfH8vlLh5/UmTXhj9du3DE+Z7B 4hrm5RhxcjbNT85d0kTd9avkfqJja3JIl326y8bmCtwU/aNX7TeBAMMzWDv2Dodtyfgl z6VxpsXQonL2o8IRnUdZuV4G0btjdXNVFfOPBiunSvldJOOZdpOgXZ3PNsP/EpnIZbTB qx/AABN3AbiMsPz4W5swzgonHT1aCdoRN46mzK2F5VrjDMlzf79I1Dgha5UWxyu+aEhc 39Hw== X-Gm-Message-State: AOAM531rJMWbMVyc2R2nvpcYcen0tsR3dh7nUpVlL5SZY8DbF4TQYzIL P68glpJFEecEkh8XUhveFSqJCLv3aVID2Z7koJ8= X-Google-Smtp-Source: ABdhPJxRiSPwBKZYjLgDMo7wTbIpnGPv47P4/5iZqMLxGT36zv5kHjJ5fhXa2NTOm2UEXawbTTwNV52htbxqBLWTOwU= X-Received: by 2002:a65:604d:0:b0:3fc:57c8:e6eb with SMTP id a13-20020a65604d000000b003fc57c8e6ebmr7262906pgp.260.1654084000241; Wed, 01 Jun 2022 04:46:40 -0700 (PDT) MIME-Version: 1.0 References: <20220601115026.452a6840@vepi2> In-Reply-To: From: Arjen Markus Date: Wed, 1 Jun 2022 13:46:29 +0200 Message-ID: Subject: Re: is there a way to find out gfortran version and/or options from a given binary? To: Kay Diederichs Cc: Andre Vehreschild , Fortran List X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Wed, 01 Jun 2022 11:46:44 -0000 Are you sure that -g is the trigger? It may very well be that you need to make sure that the optimiser does not eliminate the variable that holds the identification. That is why I write the first character of these strings, to make sure that the variables are retained. That could be achieved in all manner of ways to fool the optimiser. Note that with -O2 and the program I posted I still get the strings. Regards, Arjen Op wo 1 jun. 2022 om 13:36 schreef Arjen Markus = : > Hm, I ran it without any options - would that be equivalent to -g then? A > rather awkward workaround might be to compile one source file containing > this code with -g, but that is pushing things to the limit. > > Regards, > > Arjen > > Op wo 1 jun. 2022 om 12:16 schreef Kay Diederichs < > kay.diederichs@uni-konstanz.de>: > >> I tried your suggestion below, but it does not store the options unless >> the -g option is used. >> >> If -g is used, the executable _always_ has version and option info (no >> extra code invoking compiler_version() and compiler_options() is >> needed). Just use strings | grep GNU . >> If -g is not used, no option info is in the executable. >> >> Best wishes, >> Kay >> >> On 01.06.22 12:00, Arjen Markus wrote: >> > staticv.f90 -- >> > ! Static information about the compiler? Not via parameters >> > ! >> > program staticv >> > use iso_fortran_env >> > >> > implicit none >> > character(len=3D200) :: c, d >> > >> > c =3D compiler_version() >> > d =3D compiler_options() >> > write(*,*) c(1:1), d(1:)1 >> > end program staticv >> > >> >> -- >> Kay Diederichs http://strucbio.biologie.uni-konstanz.de >> email: Kay.Diederichs@uni-konstanz.de Tel +49 7531 88 4049 >> Fachbereich Biologie, Universit=C3=A4t Konstanz, Box M647, D-78457 Konst= anz >> >> This e-mail is digitally signed. If your e-mail client does not have the >> necessary capabilities, just ignore the attached signature "smime.p7s". >> >