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

last preprocessor variable define ignored

marinoni__andrea_mas
962 Views

Dear all,

I have cretaed a test case fortran solution wher ethe main program is including a file name 'preproc.env' where II have defined preprocessor variables as:

!DEC$ ALFA = 1 ! comment

!DEC$ BETA = 1 ! comment

I have noticed the last variable definition (BETA) is ignored by the preprocessor compiler.

No matter how many variables are defined.

Actually I found that if I remove the comment from the last line then it works:

!DEC$ ALFA = 1 ! comment

!DEC$ BETA = 1

Am I violating any rules regarding variable definition ?

I attach a test case solution, it could be a possible issue/error.

Best regards,

Andrea

0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
918 Views

Use

!DIR$ DEFINE ALPHA = 1
!DIR$ DEFINE BETA = 1
...
!DIR$ IF DEFINED(ALPHA)
  ...
  !DIR$ IF(BETA == 1)
  ...
  !DIR$ ENDIF
  ...
!DIR$ ENDIF

!DEC$ should be interchangeable with !DIR$. 

Try inserting the DEFINE keyword in your !DEC$ defines.

see: IF Directive Construct (intel.com)

Jim Dempsey

0 Kudos
marinoni__andrea_mas
806 Views

Dear Jim,

thank you for your answer, I will exploit your workarund.

However I am highlighting the issue, because I think this is an error.

It seems strange to me that the same code lines change the result, with or without a comment at the end of the last line of the file 'preproc.env'.

Andrea.

0 Kudos
andrew_4619
Honored Contributor III
796 Views

Well maybe it didn't work, maybe alpha was  defined as 1 elsewhere? Try !DEC$ ALFA = 2 ! comment and then see if alpha is still 1 where you check it before.

 

 

0 Kudos
Reply