Bug in ifort/ifx when parsing a comment?

Hi all,

When compiling with this flag with mpiifx, I got this output. Perhaps the compiler is parsing the comment incorrectly?

mpiifx -O0 -g -traceback -fpe0 -stand f18 -cpp -D_DEBUG -D_TIMING -D_DECOMP_X -I./dependencies/2decomp-fft/mod -module ./src -c -o src/mom.f90.o src/mom.f90
src/timer.f90(101): warning #5268: Extension to standard: The text exceeds right hand column allowed on the line.
    integer         , intent(inout), optional :: nvtx_id_inc     ! to increment the id, e.g.: call timer_tic(name,nvtx_id_inc=i_nvtx)

Line: https://github.com/CaNS-World/CaNS/blob/main/src/timer.f90#L101

1 Like

The maximum line length in Fortran 2018 is 132 characters (6.3.2.1 Free form line length). The line indicated is 134 characters long. The compiler is correct.

1 Like

Right, thanks!

But then I don’t understand why I don’t get the same warning for the line below: https://github.com/CaNS-World/CaNS/blob/main/src/timer.f90#L102, unless I comment the previous line.

If I don’t comment line 101 in that file:

mpiifx -O0 -warn all -g -traceback -fpe0 -stand f18 -cpp -D_DEBUG -D_TIMING -D_DECOMP_X -I./dependencies/2decomp-fft/mod -module ./src -c -o src/timer.f90.o src/timer.f90
src/timer.f90(101): warning #5268: Extension to standard: The text exceeds right hand column allowed on the line.
    integer         , intent(inout), optional :: nvtx_id_inc     ! to increment the id, e.g.: call timer_tic(name,nvtx_id_inc=i_nvtx)

And if I do:

mpiifx -O0 -warn all -g -traceback -fpe0 -stand f18 -cpp -D_DEBUG -D_TIMING -D_DECOMP_X -I./dependencies/2decomp-fft/mod -module ./src -c -o src/timer.f90.o src/timer.f90
src/timer.f90(101): warning #5268: Extension to standard: The text exceeds right hand column allowed on the line.
!    integer         , intent(inout), optional :: nvtx_id_inc     ! to increment the id, e.g.: call timer_tic(name,nvtx_id_inc=i_nvtx)
------------------------------------------------------------------------------------------------------------------------------------^
src/timer.f90(102): warning #5268: Extension to standard: The text exceeds right hand column allowed on the line.
    integer         , intent(in   ), optional :: nvtx_gpu_stream ! to optionally sync host/device over a stream/queue (asynchronous if < 0)
------------------------------------------------------------------------------------------------------------------------------------^

Perhaps it only warns on the first line it encounters. I saw something similar last week with ifort and tabs in the source code.

Edit: I didn’t read your post properly. I have no idea why it does that.

1 Like

You get a separate warning for a comment line and a non-comment statement line, but only one warning in each class for a given source file?

1 Like

I guess that’s probably it. Thanks!

@pcosta Have you tried inserting a blank-line between the two long lines? i.e.

   ... long line 1

   ... long line 2