<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 - Semantic error is not coming for duplicate type specification in type guard statement"
   href="https://bugs.llvm.org/show_bug.cgi?id=46830">46830</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Semantic error is not coming for duplicate type specification in type guard statement
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Inderjeet_kalra@hcl.com
          </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>Issue: 
-----
If selector is unlimited polymorphic object and type guard statement has
integer type specification which is already specified by previous type guard
statement then semantic error is not coming.

Fortran 2018 spec:
-----------------
C1163 (R1152) For a given select-type-construct, the same type and kind type
parameter values shall not be specified in more than one TYPE IS
type-guard-stmt and shall not be specified in more than one CLASS IS
type-guard-stmt.


Kindly refer following 2 test cases. selecttype_intrinsic.f90 has issue and
selecttype.f90 returns expected error.

[root@localhost Base_compiler]# f18 selecttype_intrinsic.f90 
/tmp/f18-56ab.f90:10:11:

   TYPE IS (INTEGER)
           2
   TYPE IS (INTEGER)
           1
Error: TYPE IS at (1) overlaps with TYPE IS at (2)
[root@localhost Base_compiler]# cat -n selecttype_intrinsic.f90 
     1  type ty
     2   integer :: ii
     3  end type
     4  class(*),allocatable :: cptr_unlim
     5  
     6  call sub1()
     7  contains 
     8  subroutine sub1()
     9  select type(cptr_unlim)
    10   !ERROR: Type specification 'integer' conflicts with previous type
specification
    11   type is(integer) 
    12   type is(integer) 
    13  end select
    14  end 
    15  end 
[root@localhost Base_compiler]# 


- Following case returns expected error:

[root@localhost Base_compiler]# f18 selecttype.f90 
selecttype.f90:12:2: error: Type specification 'ty' conflicts with previous
type specification
   type is(ty) 
   ^^^^^^^^^^^
selecttype.f90:11:2: Conflicting type specification 'ty'
   type is(ty) 
   ^^^^^^^^^^^
f18: semantic errors in selecttype.f90
[root@localhost Base_compiler]# cat -n selecttype.f90 
     1  type ty
     2   integer :: ii
     3  end type
     4  class(ty),allocatable :: cptr
     5  
     6  call sub2()
     7  contains 
     8  subroutine sub2()
     9  select type(cptr)
    10   !ERROR: Type specification 'ty' conflicts with previous type
specification
    11   type is(ty) 
    12   type is(ty) 
    13  end select
    14  end
    15  end</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>