brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 4e98d9e Raw
57 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in NULLIFY statements3 4INTEGER, PARAMETER :: maxvalue=10245 6Type dt7  Integer :: l = 38End Type9Type t10  Type(dt) :: p11End Type12 13Type(t),Allocatable :: x(:)14 15Integer :: pi16Procedure(Real) :: prp17 18Allocate(x(3))19!ERROR: 'p' may not appear in NULLIFY20!BECAUSE: 'p' is not a pointer21Nullify(x(2)%p)22 23!ERROR: 'pi' may not appear in NULLIFY24!BECAUSE: 'pi' is not a pointer25Nullify(pi)26 27!ERROR: 'prp' may not appear in NULLIFY28!BECAUSE: 'prp' is not a pointer29Nullify(prp)30 31!ERROR: 'maxvalue' may not appear in NULLIFY32!BECAUSE: 'maxvalue' is not a pointer33Nullify(maxvalue)34 35End Program36 37! Make sure that the compiler doesn't crash when NULLIFY is used in a context38! that has reported errors39module badNullify40  interface41    function ptrFun()42      integer, pointer :: ptrFun43    end function44  end interface45contains46  !ERROR: 'ptrfun' was not declared a separate module procedure47  !ERROR: 'ptrfun' is already declared in this scoping unit48  module function ptrFun()49    integer, pointer :: ptrFun50    real :: realVar51    nullify(ptrFun)52    !ERROR: 'realvar' may not appear in NULLIFY53    !BECAUSE: 'realvar' is not a pointer54    nullify(realVar)55  end function56end module57