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 Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-11/root/usr --mandir=/opt/rh/devtoolset-11/root/usr/share/man --infodir=/opt/rh/devtoolset-11/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20210728/obj-x86_64-redhat-linux/isl-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC) [dikay@turn29]$ cat staticv.f90 ! staticv.f90 -- ! Static information about the compiler? Not via parameters ! program staticv use iso_fortran_env implicit none character(len=200) :: c, d c = compiler_version() d = compiler_options() write(*,*) c(1:1), d(1:1) end program staticv [dikay@turn29]$ gfortran staticv.f90 [dikay@turn29]$ strings a.out | grep GNU GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44) GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1) __GNU_EH_FRAME_HDR [dikay@turn29]$ gfortran staticv.f90 [dikay@turn29]$ strings a.out | grep GNU GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44) GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1) __GNU_EH_FRAME_HDR [dikay@turn29]$ gfortran -g staticv.f90 [dikay@turn29]$ strings a.out | grep GNU GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44) GCC: (GNU) 11.2.1 20210728 (Red Hat 11.2.1-1) GNU Fortran2008 11.2.1 20210728 (Red Hat 11.2.1-1) -mtune=generic -march=x86-64 -g -fintrinsic-modules-path /scratch/opt/rh/devtoolset-11/root/usr/bin/../lib/gcc/x86_64-redhat-linux/11/finclude __GNU_EH_FRAME_HDR Best wishes, Kay On 6/1/22 13:46, Arjen Markus wrote: > 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 >: > > 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=200) :: c, d > > > >      c = compiler_version() > >      d = 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ät Konstanz, Box M647, D-78457 Konstanz > > This e-mail is digitally signed. If your e-mail client does not have the > necessary capabilities, just ignore the attached signature "smime.p7s". > -- Kay Diederichs http://strucbio.biologie.uni-konstanz.de email: Kay.Diederichs@uni-konstanz.de Tel +49 7531 88 4049 Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz This e-mail is digitally signed. If your e-mail client does not have the necessary capabilities, just ignore the attached signature "smime.p7s".