[llvm-bugs] [Bug 46789] New: Expected compile time error is not coming for Select type specification.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 21 07:13:57 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46789

            Bug ID: 46789
           Summary: Expected compile time error is not coming for Select
                    type specification.
           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

Created attachment 23761
  --> https://bugs.llvm.org/attachment.cgi?id=23761&action=edit
Test program.

Issue is related to Semantic specification checks for Select Type construct.
F18 compiler is not generating expected compilation error.

As per below Fortran 2018 specification, compile time error should be generated
if Selector is NOT unlimited Polymorphic and Intrinsic type specification is
specified in Type Guard statement.

C1162 (R1152) If selector is not unlimited polymorphic, each TYPE IS or CLASS
IS type-guard-stmt shall specify an extension of the declared type of selector.

Test program:  Error is expected at line #16.
============
[root at localhost Select_type_fix]# cat -n selecttype04.f90 
     1  type base
     2   integer :: ii
     3  end type
     4  type,extends(base) :: ext
     5   integer :: jj
     6  end type
     7  call CheckC1162()
     8  contains
     9    subroutine CheckC1162()
    10     class(base),allocatable :: aobj
    11     allocate(ext::aobj)
    12     select type(sel=>aobj)
    13      ! OK
    14      class is(base)
    15      !ERROR: Intrinsic Type specification must not be specified
    16      type is(integer)
    17      ! OK
    18      class default
    19     end select
    20    end
    21  end

-  Gfortran behavior is correct, expected compilation Error is coming.

[root at localhost Select_type_fix]# gfortran selecttype04.f90 
selecttype04.f90:16:12:

     type is(integer)
            1
Error: Unexpected intrinsic type ‘INTEGER’ at (1)

[root at localhost Select_type_fix]# gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 7.3.0 (GCC) 
[root at localhost Select_type_fix]#

-- 
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/20200721/1302e284/attachment.html>


More information about the llvm-bugs mailing list