# Bug in ifort/ifx when parsing a comment?

**URL:** https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698
**Category:** Uncategorized
**Created:** [October 27, 2023, 8:19am UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698 "2023-10-27T08:19:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pcosta](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pcosta/32/5504_2.png) [@pcosta](https://fortran-lang.discourse.group/u/pcosta)
#### Post date: [October 27, 2023, 8:19am UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/1 "2023-10-27T08:19:38Z")

</div>

Hi all,

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

```fortran
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](https://github.com/CaNS-World/CaNS/blob/main/src/timer.f90#L101)

---

<div class="post-metadata">

### Author: ![DavidB](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DavidB](https://fortran-lang.discourse.group/u/DavidB)
#### Post date: [October 27, 2023, 9:30am UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/2 "2023-10-27T09:30:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pcosta](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pcosta/32/5504_2.png) [@pcosta](https://fortran-lang.discourse.group/u/pcosta)
#### Post date: [October 27, 2023, 9:44am UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/3 "2023-10-27T09:44:09Z")

</div>

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](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:

```plaintext
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:

```plaintext
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)
------------------------------------------------------------------------------------------------------------------------------------^

```

---

<div class="post-metadata">

### Author: ![DavidB](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DavidB](https://fortran-lang.discourse.group/u/DavidB)
#### Post date: [October 27, 2023, 10:52am UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/4 "2023-10-27T10:52:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![themos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/themos/32/521_2.png) [@themos](https://fortran-lang.discourse.group/u/themos)
#### Post date: [October 27, 2023, 1:13pm UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/5 "2023-10-27T13:13:11Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pcosta](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pcosta/32/5504_2.png) [@pcosta](https://fortran-lang.discourse.group/u/pcosta)
#### Post date: [October 27, 2023, 1:23pm UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/6 "2023-10-27T13:23:17Z")

</div>

I guess that’s probably it. Thanks!

---

<div class="post-metadata">

### Author: ![mEm](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mEm](https://fortran-lang.discourse.group/u/mEm)
#### Post date: [October 27, 2023, 2:29pm UTC](https://fortran-lang.discourse.group/t/bug-in-ifort-ifx-when-parsing-a-comment/6698/7 "2023-10-27T14:29:48Z")

</div>

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

```auto
   ... long line 1

   ... long line 2

```
