<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/83549>83549</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang] flang accepts definition of selectors that are polymorphic pointer function results. Nag, gfortran, xlf do not. 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            question,
            flang:semantics
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            klausler
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jeanPerier
      </td>
    </tr>
</table>

<pre>
    gfortran expects the following test to be rejected by semantic on the basis that the selector cannot be defined. 
https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/select_type_17.f90

Flang, ifort, and nvfortran accept it, and I do not see why it should be rejected given `fun(1)` is a variable since `fun` result is a POINTER (F2018 and C1158 and R902).

I am just surprised that all of nag, xlf, and gfortran reject it, and I would like to confirm that this program is valid and I am not missing some rule here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU81upDgQfhpzKQ0ypuluDhyyySLlMjsa7T0ydgGVGJt1mU767VdAd7K57QXKwh9V9f1oZho8YiOqP4RSb04v7DAKpUT1lOkljSE2r6j9L4yEMeuCvTZDH2KK2gN-zGgSQxoR-uBceCc_QEJOkAJ0CBFf0SS00F2BcdI-kYHgN0CnmVaoTtuR0aFJIYLR3oe0oi325NHmIOSTkA9jSjOL8kGoVqh2oDQuXW7CJFTr3OX--rG2_8ELJRSq7VzohGonTV6ott3nXtH9ZxlxiMhMYT3sU7yk64wvxSnva7n33p-t034Q6hFoha-F9hb85c6HNgbnBPT56RlsgHUbRoT38QqUgMewOPuNnYEu6EEcZb94oc6FULU4SiAGDRcdSXcOgckbvF86SojIi0v7pV9_Pf_8-8_fINS5VbI4b80fi6Laq9-1VELV-X93eQY9wevCCXiJcyRGu4uhnYPQg9fbph-uvy_zKfs-97c137edHL3hqrwJvqc43cUlhjmGIeppnfaiHdkbTE8bOxMxr87hMCHExSGMGDHPbFPauqx1hk1xkrU6n4pDnY2NktKeu6o8m76rjK5sdZJa2-pYVaiN6jJqlFQHWcpC1lUt61weSyOtsVIfi2NZoDhInDS5fLVMHuKQEfOCzbmsDnXmdIeOb5n4Z0FOmzuUUI9CqX5zQflwNzTf0hKbzX_dMrA4SEec-Ov3iZLbUrajqyfYiptlePc6rX1W8u9huOVDR4Q5uOsU4jySgTmQTxihX7zZILsXOIefu2pf9t4UvLkwh2yJrvmfOZpjWGUWqt2oYaHajZ1_AwAA__9Wq2V9">