Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29375 Discussions

ifx does not honour `-grecord-gcc-switches` without `-g`?

Manodeep
Beginner
177 Views

Per the docs, `-grecord-gcc-switches` should record the compiler invocation. However, from my tests with the 2025.2.0 release, I get the compiler invocation line *iff* an additional `-g` flag is also added. May be this is intended/implied, but it would be good to clarify in the documentation. 

Here's what I did:

```sh

[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ ml
Currently Loaded Modulefiles:
1) intel-compiler-llvm/2025.2.0

 

# hello test program

[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ cat hello.f90
program hello
print *, "hello test"
end program

 

# Adding `-g` alongside `-grecord-gcc-switches` captures the compiler line in the `.debug_str` section

[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ ifx -g -grecord-gcc-switches -O2 -march=native hello.f90 -c
[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ readelf --string-dump=.debug_str hello.o

String dump of section '.debug_str':
[ 0] Intel(R) Fortran 25.0-1485 --gcc-toolchain=/usr -g -grecord-gcc-switches -O2 -march=native -c -isystem/opt/Modules/v4.3.0/init/ksh-functions
[ 8e] hello.f90
[ 98] /home/593/ms2335/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag
[ e6] MAIN__
[ ed] hello

 

# compiling without `-g` does not create the relevant section

[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ ifx -grecord-gcc-switches -O2 -march=native hello.f90 -c
[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ readelf --string-dump=.debug_str hello.o
readelf: hello.o: Warning: Section '.debug_str' was not dumped because it does not exist!

 

# compiling with `-g` but without the `-grecord-gcc-switches` does not store the compiler invocation line

[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ ifx -g -O2 -march=native hello.f90 -c
[~/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag @gadi-login-02]$ readelf --string-dump=.debug_str hello.o

String dump of section '.debug_str':
[ 0] Intel(R) Fortran 25.0-1485
[ 1b] hello.f90
[ 25] /home/593/ms2335/temp/testing_fortran_compiler/test_ifx_grecord_switches_flag
[ 73] MAIN__
[ 7a] hello

```

 

Cheers!
Manodeep

0 Kudos
0 Replies
Reply