cancel
Showing results for 
Search instead for 
Did you mean: 

Server Processors

mfvalin
Adept I

How to identify the flang compiler

How can one identify the flang compiler using the preprocessor ?

#if defined(some_appropriate_name)

is there a way to get the flang preprocessor to dump its predefined macros ?

(like -E -dM for gfortran)

0 Likes
1 Solution
shrjoshi
Staff

Hi @mfvalin 

For flang preprocessor to dump its predefined macros, can you try the command : "flang file_name.F90 -Hx,122,0x40000"
Please ensure that the fortran file has ".F90" extension.

View solution in original post

0 Likes
3 Replies

Hi mfvalin,

You can identify the flang using “__PGLLVM__” constant. Below is the sample program:

program main
#ifdef __PGLLVM__
print *, "hello world"
#endif
end program

This above program can be compiled using the command “flang -cpp -o f.out test.f90”.

I have filed a feature request to get the dump of all the predefined macros in flang.

0 Likes

Hi mfvalin, can you try below command?

flang -dM -E - < /dev/null

0 Likes
shrjoshi
Staff

Hi @mfvalin 

For flang preprocessor to dump its predefined macros, can you try the command : "flang file_name.F90 -Hx,122,0x40000"
Please ensure that the fortran file has ".F90" extension.

0 Likes