<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - IGNORE_TKR directive with gfortran"
   href="https://bugs.llvm.org/show_bug.cgi?id=52152">52152</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IGNORE_TKR directive with gfortran
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>flang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gilles@rist.or.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>David.Truby@arm.com, jperier@nvidia.com, kirankumartp@gmail.com, llvm-bugs@lists.llvm.org, sscalpone@nvidia.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25356" name="attach_25356" title="a reproducer to evidence the issue">attachment 25356</a> <a href="attachment.cgi?id=25356&action=edit" title="a reproducer to evidence the issue">[details]</a></span>
a reproducer to evidence the issue

The attached conftest.f90 program can be used in order to evidence the issue.

gfortran -c conftest.f90

should work (it can issue a warning related to an type/interface mismatch, but
that can be ignored).

Now the same file fails to compile with flang resulting into an error in the
gfortran backend

<span class="quote">> Error: Rank mismatch in argument 'buffer' at (1) (rank-1 and scalar)</span >
flang_unparsed_file_e29b812d7687_0.f90:36:19:


What happens is the 'buffer' dummy argument of the 'foo' subroutine has the
following directive

       !GCC$ ATTRIBUTES NO_ARG_CHECK :: buffer

This is GCC specific (as the !GCC$ sentinel implies), and is simply stripped by
flang.
Consequently, the flang-processed file contains no such directive and hence
gfortran fails.

flang offers a similar directive
!DIR$ IGNORE_TKR buffer
that is passed as-is to gfortran.

Unfortunately, gfortran does not understand this directive and the compilation
fails.


Of course, one option is to have the fine GNU folks update gfortran to support
this directive.


Other options at the flang level could be to
 - pass through unknown and/or gfortran specific directives
 - translate flang to gfortran directives

Will you be willing to consider doing something about that at the flang level?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>