[llvm-bugs] [Bug 46830] New: Semantic error is not coming for duplicate type specification in type guard statement
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 23 23:40:24 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46830
Bug ID: 46830
Summary: Semantic error is not coming for duplicate type
specification in type guard statement
Product: flang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedbugs at nondot.org
Reporter: Inderjeet_kalra at hcl.com
CC: David.Truby at arm.com, jperier at nvidia.com,
kirankumartp at gmail.com, llvm-bugs at lists.llvm.org,
sscalpone at nvidia.com
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 at 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 at 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 at localhost Base_compiler]#
- Following case returns expected error:
[root at 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 at 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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200724/c58592bf/attachment.html>
More information about the llvm-bugs
mailing list