Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-03 Thread Kay Diederichs
On 6/3/22 10:16, Janne Blomqvist via Fortran wrote: On Fri, Jun 3, 2022 at 10:30 AM Arjen Markus via Fortran wrote: Hi Kay, (you forgot to reply to everybody ;)) I am using a Windows version of gfortran and strings. I use a file viewer that comes with the Total Commander file manager. So,

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-03 Thread Arjen Markus via Fortran
Hi Kay, (you forgot to reply to everybody ;)) I am using a Windows version of gfortran and strings. I use a file viewer that comes with the Total Commander file manager. So, it may be something specific to that version of strings. Regards, Arjen Op vr 3 jun. 2022 om 09:25 schreef Kay

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-02 Thread Janne Blomqvist via Fortran
On Thu, Jun 2, 2022 at 10:33 PM Kay Diederichs wrote: > Am 02.06.22 um 21:06 schrieb Janne Blomqvist: > > As an alternative approach, make a command-line option (say, "-v") > > that prints the version number of the program, name of the author and > > other pertinent information, as well as the

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-02 Thread Kay Diederichs
Am 02.06.22 um 21:06 schrieb Janne Blomqvist: On Wed, Jun 1, 2022 at 1:16 PM Kay Diederichs wrote: If -g is used, the executable _always_ has version and option info Well, isn't that the answer to your question then? As an alternative approach, make a command-line option (say, "-v") that

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-02 Thread Janne Blomqvist via Fortran
On Wed, Jun 1, 2022 at 1:16 PM Kay Diederichs wrote: > If -g is used, the executable _always_ has version and option info Well, isn't that the answer to your question then? As an alternative approach, make a command-line option (say, "-v") that prints the version number of the program, name of

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
Hm, I was using a file viewer, not strings to examine the file and I looked for the text "GCC". That must be the difference. Indeed, strings does not show that string nor any string containing "GCC" Here is a small part of the text in the file (compiled without -O2, as with it some characters

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Kay Diederichs
Hi Arjen, below is what I get with gfortran 11.2.1 and no options, or just -g: [dikay@turn29]$ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/scratch/opt/rh/devtoolset-11/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/11/lto-wrapper Target: x86_64-redhat-linux

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
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

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
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 <

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Kay Diederichs
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

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
Well, if you call these functions in the code, the text is available in the executable file. I used: ! staticv.f90 -- ! Static information about the compiler? Not via parameters ! program staticv use iso_fortran_env implicit none character(len=200) :: c, d c =

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
I thought you might get this information by using these two functions in a parameter definition, but that is not allowed, alas. Regards, Arjen Op wo 1 jun. 2022 om 11:50 schreef Andre Vehreschild via Fortran < fortran@gcc.gnu.org>: > Hi Kay, > > did you try: > > $ strings

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Andre Vehreschild via Fortran
Hi Kay, did you try: $ strings coarray_collectives_18 | grep GNU GCC: (GNU) 11.2.1 20211203 (Red Hat 11.2.1-7) GCC: (GNU) 12.0.1 20220214 (experimental) GNU Fortran2008 12.0.1 20220214 (experimental) -mtune=generic -march=x86-64 -g -fcoarray=lib -fintrinsic-modules-path

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Kay Diederichs
Hi Arjen, thanks for your answer. I do know about these functions, and use them in my own programs if appropriate. However, programs distributed to others for production use should not output this because it confuses users (as does "Note: The following floating-point exceptions are signalling:

Re: is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Arjen Markus via Fortran
Are you perhaps looking for the compiler_version() and compiler_options() functions? I use them like this, they were defined in Fortran 2008 if I am not mistaken: WRITE( lurep, '(a)' ) 'Report of simulation' WRITE( lurep, '(a)' ) ''

is there a way to find out gfortran version and/or options from a given binary?

2022-06-01 Thread Kay Diederichs
Hi, is there any gfortran option and/or version information available from/in a binary? Maybe accessible with objdump or strings? For ifort, we use the -sox option ("This option tells the compiler to save the compilation options and version number in the executable file. ..."). This enables